If I already have an entry in /etc/rc.d/rc2.d with a file S99abc, and if I need to execute another script, then what should my file name convention be ? can it be S99def ? how do I ensure that S99abc is executed first before S99def ? any help is appreciated!
They are executed in ABC-order, eg S98abc before S99def. Usually they are symlinks to the actual scripts, eg:
$ ls -l /etc/rc.d/rc2.d/*httpd*
lrwxrwxrwx 1 root system /etc/rc.d/rc2.d/K08httpd -> ../init.d/httpd
lrwxrwxrwx 1 root system /etc/rc.d/rc2.d/S92httpd -> ../init.d/httpd
Also usually the same script is called at start and stop, eg:
$ cat /etc/rc.d/init.d/httpd
#!/bin/sh
case "$1" in
start)
/usr/local/sbin/apachectl start
;;
stop)
/usr/local/sbin/apachectl stop
;;
status)
/usr/local/sbin/apachectl status
;;
*)
echo "usage: $0 (start|stop|status)"
;;
esac