Wednesday, December 5, 2007

Create Auto Start Up Service in Linux

1-Create an script file /etc/init.d/abcdef that contain
#!/sbin/sh
case "$1" in
'start')
//what should be lunched to start task
;;
'stop')
//what should be lunched to stop task
;;
'restart')
//what should be lunched to restart task like goto stop and start
;;

*)
//default option
;;
esac
exit 0

2-Change owner and mod of script file:
chown root:other /etc/init.d/abcdef
chmod 774 /etc/init.d/abcdef

3-Make symbolic link for auto start and stop at desired runlevel RC
ln -s /etc/init.d/abcdef /etc/rc2.s/S99abc
ln -s /etc/init.d/abcdef /etc/rc0.s/K34abc

No comments: