On Fri, 21 Jan 2005 11:17:31 +1300
Andrew Errington <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I have a "style" question regarding a process that I wish to run all the 
> time.
> 
> Basically, my weather data collection comprises two programs.  One is a 
> program to query the temperature sensor.  The other is a Perl script to 
> query the wind sensor.  Both programs output to a text file, then a cron 
> job generates graphs from the data in the text file.
> 
> At the moment I have the programs running in two terminal windows.  I want 
> to automate them so they will:

I am thinking that these programs probably do nt need to run
continuously anyway.

i assume they are doing something like:

begin
poll sensor
write data
sleep x minutes
again

would it be better to rewrite the program to just do:

begin
poll sensor
write data
end

then let cron do the scheduling every x minutes. that way as long as
cron is running, your data collection program should run. if the data
collection program outputs a value indicating whether or not it has
finished successfuly, you can get cron to send you an email on failure.

just another option...

> 
> a) Run automatically when the server is rebooted (with a current uptime of 
> 228 days I am loathe to test that...)
> b) Restart automatically if they ever stop running
> 
> I am sure there are a number of common techniques for this, but is there a 
> 'best' one?  Should the programs run as root, or run as me?
> 
> A simple solution might be to run a cron job every hour that checks whether 
> the process is running, and if not, starts it up.  That can be set up by 
> me, and therefore the process runs as me, and covers both situations above. 
>  If the process runs as root then I need to be root to kill it if I ever 
> want to change it.
> 
> Any clues?
> 
> Thanks,
> 
> Andy

-- 
Nick Rout <[EMAIL PROTECTED]>

Reply via email to