Skip to main content

[archive] Running programs in the Background.

  • April 15, 2008
  • 7 replies
  • 0 views

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???

7 replies

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???
We have a separate runtime session with a program that polls a directory for text files. Our software can write text files in the directory that it's polling to instruct it to react as it should. We also have a program in our software that creates these files including "kill", "restart", etc.

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???
We have a separate runtime session with a program that polls a directory for text files. Our software can write text files in the directory that it's polling to instruct it to react as it should. We also have a program in our software that creates these files including "kill", "restart", etc.


I thought of that as one possible solution. But then the issue comes in, what happens if that program gets killed or hangs. Then you have to be able to re-start that in the background somehow. The real problem with that is that we can't simply re-boot the PC in this matter as the PC is a systems critical piece, in that if it is shutdown/restarted, it will stop the complete system. Beings this is in a Retail environment, that's not good. That's why I was looking for something along the line of a service solution, that way you could start and stop the service and restart it if necessary.

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???
We have a separate runtime session with a program that polls a directory for text files. Our software can write text files in the directory that it's polling to instruct it to react as it should. We also have a program in our software that creates these files including "kill", "restart", etc.


I thought of that as one possible solution. But then the issue comes in, what happens if that program gets killed or hangs. Then you have to be able to re-start that in the background somehow. The real problem with that is that we can't simply re-boot the PC in this matter as the PC is a systems critical piece, in that if it is shutdown/restarted, it will stop the complete system. Beings this is in a Retail environment, that's not good. That's why I was looking for something along the line of a service solution, that way you could start and stop the service and restart it if necessary.

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???
We can start that runtime process from our software by executing the command line. We can kill it by sending it a command to "kill" via the text file. We also have the ability to check that the process is running by asking it for a "status" via the text file. If we don't get a response, it must not be running.

I understand the desire for a service, but I'm not sure how that can be accomplished. Perhaps someone else has some suggestions...

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???
We can start that runtime process from our software by executing the command line. We can kill it by sending it a command to "kill" via the text file. We also have the ability to check that the process is running by asking it for a "status" via the text file. If we don't get a response, it must not be running.

I understand the desire for a service, but I'm not sure how that can be accomplished. Perhaps someone else has some suggestions...


Yes, but starting the process by the command line doesn't keep it running when you log out. We need to be able to log out, and while logged out, the process would still be running. Controlling the process through a file or directory isn't a problem, just what happens when you log out of windows and what happens to the app. Windows will shut down your processes and we need to be able to have multiple users log in at times, but still have the process running in the background.

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???
Hi,

I got around this issue in two ways, use the SRVANY.EXE program to run a windows program as a service, this can work depending on what the server program is doing.

The other way was to write my own windows service routine in C , its pretty straight forward, there are plenty of examples on the web, but basically the C program handles the events from windows eg Start,Stop etc and spawns the Acucobol Runtime. I have tested this and it does work, although this was a number of years ago.

Many of my clients use the first method, its simple effective and works in most cases.

Regards

Scott

[Migrated content. Thread originally posted on 14 April 2008]

I need to run a program in the background like a service. Does anybody know how to do this? This is on Windows platforms and the user needs to be able to start the program so it runs in the background, then when they log off, it needs to keep running.

This is a server type process that communicates with handheld devices that needs to remain running even though users log on and off on the server PC. They also need to be able to interact with this process in that they need to be able to stop it and be able to re-start it and log back off, etc...

Any Iteas???
Hi,

I got around this issue in two ways, use the SRVANY.EXE program to run a windows program as a service, this can work depending on what the server program is doing.

The other way was to write my own windows service routine in C , its pretty straight forward, there are plenty of examples on the web, but basically the C program handles the events from windows eg Start,Stop etc and spawns the Acucobol Runtime. I have tested this and it does work, although this was a number of years ago.

Many of my clients use the first method, its simple effective and works in most cases.

Regards

Scott