I have a mutithreaded Java program which uses a opensource library and this library has some bugs which cause deadlock I've reported the bug but it will take time for it to get fixed, I would need to continue using this program and as long as it restarts every 2-3 hours it will do the job for me. Is there any way to make program restart every x minutes?
|
|
You can try doing in your
then
The
|
|||
|
|
I suggest you to configure Supervisor for your task. It can monitor the process, restart if it fails, also provides output redirection and other nice features. See the example for program to get started. |
|||
|
|
I have a similar problem in that my website gets attacked by bots, using up all my httpd processes. I made a simple shell script to deal with it, killing all httpd processes every ten minuets. (I know, it's not a proper fix, but I'm changing providers to one that will give me proper firewall support, so I don't want to invest anything into a proper fix right now.) This is what I use:
The "uptime" and "psg httpd | wc" commands simply provide a trace on the terminal, and are unnecessary. "psg" is a function that simply runs ps and greps it for the argument, so it prints out the number of instances of the process "httpd" that are running. For your purposes, all you need is the "killall" and change "600" to the number of seconds you want to wait between killing the processes.
|
|||
|
|
