The Computer Oracle

restart program every x minutes?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Dreamlands

--

Chapters
00:00 Restart Program Every X Minutes?
00:26 Accepted Answer Score 13
00:47 Answer 2 Score 2
01:03 Thank you

--

Full question
https://superuser.com/questions/506289/r...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #debian

#avk47



ACCEPTED ANSWER

Score 13


You can try doing in your crontab :

crontab -e

then

 11 */3 * * * /usr/bin/pkill -f appli_name; /path/to/appli_name & &>/dev/null

The crontab command mean :

  • every 3 hours
  • kill appli_name
  • start appli_name in background



ANSWER 2

Score 2


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.