SoftwareTipsandTricks Forum

Go Back   SoftwareTipsandTricks Forum > Operating Systems > Windows NT/2000/2003
User Name
Password


Running a program/batch as a service

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes

  #1  
Old 12-12-2007, 11:19 AM
humbletech99 Offline
Registered User
 
Join Date: Aug 2005
Posts: 95
Running a program/batch as a service

I added a windows service to run a custom program which is called from a batch file. So I added the service using sc and created it properly (I have done this before for other programs so I know the syntax).

The problem I have is in starting the service, I always get the error:
Code:
The service did not respond to the start or control request in a timely fashion.
Talk about an annoying and generic error...

I have checked the program path and args are valid, even tried several different incarnations of it. Every incarnation works if run from cmd. The command line is:
Code:
d:\dir1\dir2\start_program.bat
where the batch simply does a cd into it's current directory and then runs another program in that directory.

The exact line given above works, I have even changed user accounts to get it to work, let it run as the system account, but the same result. If I runas the above command it works, so the account details cannot be wrong or have permissions problems.

The thing bails out with an error immediately.

The batch is written to run in the foreground, not to fork and not to exit unless the service exits and then it reaches the end of the batch file.

All I can think of is that it is not valid to try to run a batch file as a service.

Does it take a special kind of program to run as a service, perhaps one that responds to certain system calls or something?
Or is there some similar limitation about the type of program or the stucture of a program that would stop it running as a service?
Reply With Quote

  #2  
Old 12-29-2007, 11:40 AM
Disk_Contented's Avatar
Disk_Contented Offline
Temporary Ban
 
Join Date: Sep 2002
Location: In a plasma conduit
Posts: 1,625
You asked at forums all over the place! Why not just come here for the answer all along?
Quote:
FireDaemon will run native 32-bit or 64-bit applications (EXE or DLL), shortcuts or scripting / interpreted languages (eg. Java, .NET, Perl, Batch (BAT/CMD), Python, Ruby, TCL/TK, PHP) as a Windows service!
http://www.firedaemon.com/

There's an open source app of this type, but I can't remember It's name.
__________________
Where there's a will, There's a way.
Pay developers, not Rapidshare!
I know nowt, but at least I'm trying.
Quality, not quantity.
Prevention is better than cure.
Reply With Quote

  #3  
Old 12-29-2007, 07:24 PM
humbletech99 Offline
Registered User
 
Join Date: Aug 2005
Posts: 95
it took a while lot longer to get an answer here!

but that you that is a very good answer you have given. Shame firedaemon is proprietary, but I'll keep an eye out for the open source app as well...

thanks
Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spyware and Virus Issues, Hijack this Logfile contained Please Help the man Windows XP 3 10-29-2007 04:20 AM
Problems after a virus/malware. please help matt_coates Windows XP 16 10-05-2007 04:08 AM
slow internet and qttask.exe running abnormally high foxxios Software Problems and Useful Utilities 0 06-21-2007 08:35 AM
Slow loading on Restart Morriah Windows XP 2 01-14-2006 06:35 PM
Desktop Wont Load shredmaster1013 Windows XP 6 08-14-2005 06:52 AM



All times are GMT -5. The time now is 08:26 AM.


Designed by eXtremepixels. Powered by vBulletin Version 3.5.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 2.3.2 © 2005, Crawlability, Inc.