ok, have a service which seems to die often..
I'm curious how to add my script that checks if its running and restart it if required...
Im stumped as to how to add it to cron - to check every 20seconds..
is anyone able to help.?
ok, have a service which seems to die often..
I'm curious how to add my script that checks if its running and restart it if required...
Im stumped as to how to add it to cron - to check every 20seconds..
is anyone able to help.?
hi
cron only knows minutes, hours, .... etc.
for seconds you can write your own little script:
while : ; do start_your_script & ; wait ; restart_your_script; done &
ciao
"What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht
The relevant line would be something like this
But that would be minutes. What I suggest is to use/write an upstart script that starts at boot and then checks things out every 20 seconds.Code:*/20 * * * * /usr/bin/somedirectory/somecommand
Cheers!
Last edited by Johnneylee; May 21st, 2010 at 09:33 AM. Reason: Lack of comprehension
Im no good at writing any type of scripts apart from ultra basic scripts.... so im stumped as how to approach this...
solved... didnt use cron..
using something more crude..
Code:#!/bin/bash RESTART="/etc/init.d/myscript.service start" PGREP="/usr/bin/pgrep" while true do $PGREP mjpg_streamer || $RESTART sleep 20 done
Bookmarks