2 possible solutions that I can think of to do this.
1. Make it a service. Have to make a start up script (bourne shell usually) and link the script to whatever run level directory you want it to start at ( probable 5 ).
2. Add the perl script to the a similar init script ( ie. if it is a network thing, then add the /etc/init.d/network script ). This is cheating, and not really advisable, but definately the easiest method.
basic startup script follows:
#########################
# start some process
#########################
RETVAL=0
case "$1" in
start)
/yourpathtoscript/script.pl
;;
stop)
## pkill very dangerous, ensure the perl script name is unique
pkill script.pl
;;
status|restart|reload)
;;
*)
echo "Usage: sysstat {start|stop|status|restart|reload}"
exit 1
esac
exit $RETVAL
######
## end of script
######
make script executable and copy to /etc/init.d/
Then you need to decide the run_level ( probable 5 ) and do either symbolic link to /etc/rc5.d
# cd /etc/rc5.d
# ln -s ../init.d/yourstartscript S99yourstartscript
The S99 is order in which it is started. You can also ( and should ) make a K99yourstartscript, which will properly kill the process on reboots and changes to the run-level.
I probable forgot something, but this should get you started.
Pete
|