Personal computing discussed

Moderators: renee, SecretSquirrel, just brew it!

 
gubbar924
Gerbil Team Leader
Topic Author
Posts: 265
Joined: Wed Feb 27, 2002 7:00 pm

Stupid windows services! Now what do I do?!

Fri May 14, 2004 1:37 am

I know there are about a hundred packages out there that install Folding@Home as a windows service for you.

Well I tried my own way, and its bugging the hell out of me cuz I cant figure out why its not working for me! I went ahead and used some other package to install F@H as a service, and technically it works fine.

It works, but personally I think installing services using intsrv.exe, netsrv.exe, and srvany.exe sucks. I prefer to use the SC command.


THIS IS WHAT I DID...

- I made a new folder D:\Folding@Home\
- I downloaded FAH4Console.exe into that folder.
- I placed 2 .bat files within that folder.
- install_service.bat
- delete_service.bat



install_service.bat
@ECHO OFF

ECHO.
ECHO First, we'll configure Folding@Home's console.
ECHO.
pause

%cd%\FAH4Console.exe -local -configonly

ECHO.
ECHO.
ECHO Now we'll tell windows to...
ECHO 1) run Folding@Home as a service
ECHO 2) set the description for the service
ECHO 3) tell windows what to do if Folding@Home fails to start
ECHO 4) start the service and exit this window.
ECHO.
pause

sc create Folding@Home binpath= "%cd%\FAH4Console.exe -service -advmethods -forceSSE -forceasm -local -service -verbosity 9" start= auto displayname= Folding@Home
sc description Folding@Home "Folding@Home is a distributed computing project which studies protein folding, misfolding, aggregation, and related diseases. We use novel computational methods and large scale distributed computing, to simulate timescales thousands to millions of times longer than previously achieved. This has allowed us to simulate folding for the first time, and to now direct our approach to examine folding related disease."
sc failure Folding@Home reset= 100 actions= restart/60000/restart/90000/restart/120000
sc start Folding@Home
EXIT



delete_service.bat
@ECHO OFF
sc stop Folding@Home
sc delete Folding@Home
EXIT





As far as it goes, everything's fine...until you tell it to actually start the service.
At that point, I keep getting Error 1053: The service did not respond to the start or control request in a timely fashion.


What do I do now?
<img src="http://gfx.statgfx.com/old/folding.cgi?&username=gubbar&teamid=2630&label=255,255,255&header=255,255,255&stats=255,255,255&trans=yes&template=techreport&.jpg&cpu=2">
 
gubbar924
Gerbil Team Leader
Topic Author
Posts: 265
Joined: Wed Feb 27, 2002 7:00 pm

Fri May 14, 2004 9:31 am

anybody?
:(
 
morphine
TR Staff
Posts: 11600
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Fri May 14, 2004 9:41 am

What does this have to do with the Developer's Den, exactly?...
 
mattsteg
Gerbil God
Posts: 15782
Joined: Thu Dec 27, 2001 7:00 pm
Location: Applauding the new/old variable width forums
Contact:

Fri May 14, 2004 9:52 am

morphine wrote:
What does this have to do with the Developer's Den, exactly?...
Batchfiles can easily be considered programming.
...
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Fri May 14, 2004 9:56 am

I'm pretty sure the reason it is not working is that the F@h client itself is not written to run as a Windows service. Windows services are special -- they need to respond to requests from the Service Manager. If the program does not respond to those requests, the error message you are getting is the result. "Normal" programs (like the F@h client) can be run as a service only if an additional "service wrapper" tool is used, to intercept and handle the requests from the Service Manager.

There are 3rd party service wrappers like Firedaemon... or if you are fluent in C++ programming (or just plain masochistic), I suppose you could write your own. But you can't just install the bare F@h client as a service with sc and expect it to work.
Nostalgia isn't what it used to be.
 
mattsteg
Gerbil God
Posts: 15782
Joined: Thu Dec 27, 2001 7:00 pm
Location: Applauding the new/old variable width forums
Contact:

Fri May 14, 2004 10:58 am

Yeah, there's probably a reason why people generally use intsrv.exe, netsrv.exe, and srvany.exe, namely that they work.
...
 
gubbar924
Gerbil Team Leader
Topic Author
Posts: 265
Joined: Wed Feb 27, 2002 7:00 pm

Fri May 14, 2004 11:23 am

1)
I wasnt sure which forum to put this post in, I just figured since it had to do with batch files and installing services it didnt really make much sense to put it in any other forum section except the one about windows...but I figured i would need some kind of programming help, so I posted it here

2)
damn it! wrapper my ass! :P when i ran FAH4Console.exe in a cmd window, I saw it calling fahcore_78.exe with a bunch of parameters. Obviously the parameters change for fahcore_78 as the parameters for fah4console change. Soooooo, I'll try just running fahcore_78 as a service instead.
(when I get home from work)
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Fri May 14, 2004 11:27 am

You can't just run the core as a service. First of all, it doesn't contain the code to communicate with the Windows Service Manager either, so you will get the same error message. Secondly, it is FAH4Console.exe that downloads the new WUs and uploads the results; if you run the core by itself (assuming it will even run at all without FAH4Console there), all it will do is finish crunching the current WU and exit.

If you want to run a non-service executable as a Windows service, you must use some sort of wrapper. Period, end of discussion.
Nostalgia isn't what it used to be.
 
UberGerbil
Grand Admiral Gerbil
Posts: 10368
Joined: Thu Jun 19, 2003 3:11 pm

Fri May 14, 2004 11:49 am

JBI is correct. Windows will not run any old EXE as a service, no matter what BAT file contortions you come up with. To be run as a service an executable has to conform to set of rules, including calling StartServiceCtrlDispatcher within 30 seconds of starting (the program you are running isn't doing that, which is why the error message says it didn't start in the required amount of time). Presumably the wrapper programs are of type SERVICE_WIN32_SHARE_PROCESS and know how to handle the various commands (if you look in the Services applet in Administrative tools you'll see that you can start and stop, and sometimes pause and resume, any service; anything that runs as a service has to written to handle that as well). It's entirely possible to write an application to function as both an ordinary console app and as a service, but presumably the app in question was not written that way. And in fact it would be better design to make it as a separate EXE or DLL and call it from a service, anyway, as that way you can also call it from a GUI app or even remotely. (I just got through doing exactly this with a .NET app)

But if you want to you could rewrite it as a service yourself. You'd want to start reading here.
 
gubbar924
Gerbil Team Leader
Topic Author
Posts: 265
Joined: Wed Feb 27, 2002 7:00 pm

Fri May 14, 2004 12:33 pm

:(


oh well, thanks for the feedback guys
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Fri May 14, 2004 1:36 pm

Just out of curiosity, why are you so opposed to using some sort of service wrapper?
Nostalgia isn't what it used to be.
 
gubbar924
Gerbil Team Leader
Topic Author
Posts: 265
Joined: Wed Feb 27, 2002 7:00 pm

Fri May 14, 2004 1:49 pm

just cuz they are wrappers...as opposed to a direct way of doing things.

i dunno, im just weird like that. I'd rather spend the time to learn how to do something the direct way, rather than (making it easier on myself and) having a middle man/layer/tier (whatever its called).

its hard to explain.
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Fri May 14, 2004 2:16 pm

gubbar924 wrote:
just cuz they are wrappers...as opposed to a direct way of doing things.

i dunno, im just weird like that. I'd rather spend the time to learn how to do something the direct way, rather than (making it easier on myself and) having a middle man/layer/tier (whatever its called).

its hard to explain.

I think I understand where you're coming from. But in this case, it simply isn't feasible -- you either need to use a 3rd party wrapper, or write your own wrapper, per the instructions UberGerbil linked.

If you had the source code to FAH4Console.exe you could modify it to run as a service, eliminating the need for the wrapper. But AFAIK Stanford does not make source code for the client available.

Yes, eliminating unnecessary middle layers is generally a good thing; but eliminating necessary ones isn't! In this case, it is sort of like saying "I want to simplify my system by wiring the hard drive directly to the CPU chip, instead of going through the IDE controller on the chipset." Unless you've got the ability to design and fabricate your own CPU chip with an integrated IDE controller on it, you're not going to get very far.
Nostalgia isn't what it used to be.

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On