Home > process > How to supervise a process and schedule a periodic restart?

How to supervise a process and schedule a periodic restart?

March 25Hits:2

I run a process that sometime crash and sometime freeze. I used supervise to have it automatically restart when it crash. However, if it freeze, it stay frozen until I am back in front of the computer. I would like a tool that would restart it when it crash, but can also be configure to do periodic kill and restart, so if it freeze, it won't stay frozen more that a given period of time.

Which tool would who suggest?



I tried using supervise from daemontools with a crontab :

First, I start with

supervise /fullpath

and I use this crontab :

0 23 * * * svc -d /fullpath
2 23 * * * svc -k /fullpath
5 23 * * * svc -u /fullpath

Where fullpath is the directory containing the file called run which start my process. The tricky part is the file called should end with :

exec java ...

Normally, I start the application with a script, but if I put that script in the file called run, when svc is executed, it send the signal to the script and the java process continue to run. I created a copy of the script and modified it to make it output the call to java with all parameter, and copied this in the file called run.

You could use cron to do this if you want...

sudo crontab -e

* /5 * * * pkill -9 <your process name here> ; <your process name here>

Would kill and restart it every 5 hours. More examples... Cron examples


Related Articles

  • How to supervise a process and schedule a periodic restart?March 25

    I run a process that sometime crash and sometime freeze. I used supervise to have it automatically restart when it crash. However, if it freeze, it stay frozen until I am back in front of the computer. I would like a tool that would restart it when i

  • Alternative to Daemontools (djbtools) to supervise unix processes?October 18

    I've used Daemontools to provide a simple and reliable way to supervise Unix services on my servers. It works well, but it requires a different way of thinking (The DJB Way) and some common complaints are: TAI64N based timestamps Doesn't store script

  • Scheduled task to restart server and software to monitor serverNovember 16

    I have a windows server 2003 that runs low on memory and to solve the problem I restart it. So to help with this I want to set up a scheduled task that restarts the server every night. Any tips on how I can create such a scheduled task? And the follo

  • Can I schedule a periodic file permissions repair?May 29

    Can I schedule a periodical file permissions repair? With Automator, maybe? --------------Solutions------------- Go to the terminal and execute "crontab -e" to add a new crontab entry. Now there are numberous syntaxical ways you can accomplish w

  • process builder - scheduled actionsJanuary 10

    I have a strange situation where my immediate actions are executed but the scheduled actions are not. I see nothing in the Paused and Waiting Interviews section. Any suggestions how to debug this? --------------Solutions------------- The problem was

  • How to determine which process sends UDP packets periodically to an IP address?March 21

    I tried looping with netstat and but the packets are small and not frequent so do not get caught (can still see them with tcpdump). Need to know which process sends those packets. --------------Solutions------------- Check tcpdump for the source port

  • How can I schedule a server restart from command line on Windows 2012?June 13

    I would like to schedule a one-time server restart, e.g. to finish installing updates early in the morning. How can I do this from the command line on Windows 2012? On Windows 2008, I would have used the at command, at 2am shutdown -r -f -c "restart&

  • Filemaker server BUG: backup schedules DISAPPEAR after restart of host machine. Workarounds?July 10

    Some time ago I discovered my Filemaker backup schedules mystically disappear. After some research I find out it happens right after restart of host machine. Eventually I found this post on official filemaker forum There is a major Schedules bug in F

  • Can't close IIS Worker Process. Can't soft restart WindowsApril 16

    I'm a developer using the IIS to host my web applications, both home and a the office. At work my project is built using ASP.NET WebAPI on the server side and HTML/AngularJS on the client side. At home my project is built using node.js on the server

  • Restarting process in CentOS if server restartsOctober 20

    I have a VPS with some Java applications (made with "Play Framework") running on ports 9000, 9001, 9002 and 9003. VPS Provider (iPage) happens to reboot servers unexpectedly from time to time, leaving all four processes down. The processes I run

  • How Windows handles scheduled tasks when restarting computer?December 2

    I have an indefinitely running scheduled task that repeats every now and then and runs for few minutes. What happens when this task is running and I click restart or shutdown computer? Will Windows let it finish first before shutdown or will Windows

  • How to suspend a process for a certain period of time?December 10

    I have several running processes which is started by a shell, but I don't want them to run during 08:00am - 20:00pm for each day because they are really bandwidth-consuming, so , I have to suspend them during that period of time instead of killing th

  • vnstat schedule usage periodOctober 17

    Is there any way to measure internet usage for a scheduled period, using vnstat ? Purpose is to monitor how much data is actually consumed during my billing period, for a month which starts from 17th to the next 16th of the month. Sometimes it feels,

  • Ubuntu: i can't kill some processes and Apache doesn't restartDecember 26

    I can't restart Apache: if i try to start it, the error is this: (98)Address already in use: AH00072: make_sock: could not bind to address no listening sockets available, shutting down AH00015: Unable to open logs Action 'start' failed. Th

  • supervisor gunicorn process not started on instance restartJanuary 31

    I am trying to configure gunicorn and supervisor for Django. I have configured gunicorn and i can run the django app using gunicorn manually. Now i have tried to configure the supervisor, the issue is that gunicorn process is not being started on ins

  • Should we design programs to randomly kill themselves? June 22

    In a nutshell, should we design death into our programs, processes, and threads at a low level, for the good of the overall system? Failures happen. Processes die. We plan for disaster and occasionally recover from it. But we rarely design and implem

  • How can I supervise processes in webmin much like supervisord?February 6

    Currently I'm using Laravel Forge hosting to manage my server, but for $10 a month just to auto deploy my git repo and sometimes disable supervisord is a bit overkill. Now I can miss the auto deploy feature, but I would like to manage supervisord in

  • Process scheduling data on linuxFebruary 7

    I am doing a project on OS and require the process scheduling data for an operating system. The data has to include the list of all processes in short-term-scheduler and long-term-scheduler along with the CPU time slice and memory requirement of ever

  • Windows scheduled task fails to complete with error code 0xc000013aMay 13

    I'm using Windows Server 2003 and have a scheduled task that fails to complete. The task is set to run a Windows Command Script (.cmd) at 3pm each day. The script runs a program that extracts some data from a SQL Server database and uploads that data

  • 7 Free Appointment Scheduling Systems

    7 Free Appointment Scheduling SystemsJune 3

    This article was written in 2009 and remains one of our most popular posts. If you're keen to learn more about scheduling and planning, you may find this recent article on tracking your hours in real time of great interest. Last week, I wrote a post

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.449 s.