most distros have a startup script called /etc/init.d/local which fires up on startup. however if the process dies this will not work without further effort.
you could run the program out of inittab, a line like this will cause the program to be restarted if it dies: x:12345:respawn:/path/to/your/script parameters x is arbitrary (butI think should be unique in inittab) 12345 are the runlevels the script should operate in respawn directs init to run the script again if it dies. the rest is obvious. of course the usual rule is to run as little as possible as root... 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: > > 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]>
