Trax Posted July 24, 2014 Share Posted July 24, 2014 I am running a compiled script as a service and have encountered a problem. For reference I am using a shell called exe2service. The basics of the script are simple. It communicates to a scale via RS232 (com port) and continually logs the findings. When the computer boots the service starts as suspected even before logging in. I can tell because the TX and RX lights on the scale flicker continually and when I do log in the log that the program generates is date and time stamped correctly. Now the problem.... when someone logs off the service hangs or something. The TX and RX lights no longer flicker and the log that is generated no longer gets updated. The service still shows up in the SCM as being started but nothing is happening. To get the service going again I have to restart it. I have gone as far as putting a beep() in the main loop and it beeps until I log off at which point the mail loop no longer appears running. I am at a loss. Something about logging off. Any ideas on how to debug this? Thanks! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 24, 2014 Moderators Share Posted July 24, 2014 Have you tried any options on the recovery tab of the service? What happens if you set it to automatically restart the service? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Bert Posted July 24, 2014 Share Posted July 24, 2014 Have you tried any options on the recovery tab of the service? What happens if you set it to automatically restart the service? I was thinking the same thing The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
clicked Posted July 24, 2014 Share Posted July 24, 2014 You probably already compiled-to-exe as a console application, but this might be worth checking. Link to comment Share on other sites More sharing options...
Trax Posted July 24, 2014 Author Share Posted July 24, 2014 X-L-Ant suggestion on service recovery options. I set all three to restart the service and no joy. I think that is because the service is already started (at least according to SCM). @clicked I would be happy to try and compile it as a console application if you could give me the How-To. What is a console application? Link to comment Share on other sites More sharing options...
Trax Posted July 27, 2014 Author Share Posted July 27, 2014 (edited) While 1 CheckMainProgram() Sleep(2000) WEnd Func CheckMainProgram() If ProcessExists("Notepad.exe") <> 0 Then Return EndIf Beep() Run("C:\Windows\Notepad.exe") EndFunc I have to be doing something amazingly stupid. Above is the code. I turn it in to a service with EXE2Service. I get a beep() when I boot the computer. I can then log in and notepad in there. I can close notepad and it will beep and re-open notepad a million times until I log off. As soon as I log off and log back on SCM tells me the service is started but no beeps, no notepad. Nothing. Edited July 28, 2014 by Trax Link to comment Share on other sites More sharing options...
Bert Posted July 28, 2014 Share Posted July 28, 2014 have the service stop on log off and restart on logon. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Trax Posted July 31, 2014 Author Share Posted July 31, 2014 have the service stop on log off and restart on logon. How do you do that? It is almost as if it is already set to stop at logoff but in a wierd way. The service stops at logoff but when I log back on SCM says the service is"started" but it isn't running. As mentioned I have to restart the service after logging back on. Your suggestion would be perfect if I could find out how to do that Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now