exit_code

Posted by MagicDuck on Tue 07 Jan 2003 02:53 AM — 4 posts, 14,953 views.

USA #0
If the server is being run as a service under win xp, can the exit_code from Win32_Exit be sent to a batch file errorlevel (or any other program) ?
Australia Forum Administrator #1
Not sure how this would work, as a service doesn't run from a batch file.

An alternative to services is to run under Cygwin and run as a detached process (eg. smaug &) however there is still the issue of reporting faults. Perhaps on a crash it could write out a file which wasn't there previously?
USA #2
Thanks for the idea, i thought of the same thing as well:

Actually, i was trying to make the reboot and shutdown commands both work properly, along with that (previously) annoying 6 am reboot, while at the same time running smaug as a service. I ended up adding a bit of code to Win32_Exit to create a "reboot.txt" every time the reboot command is given, and then getting a batch file to run the whole thing.
Australia Forum Administrator #3
I did write a small script a while back with a small supporting program, that tested if the server was up and if not, restarted it. You could adapt that too to allow for crashes. The script/program is in the downloads area somewhere, maybe in the utilities section.