To get a daemon to start when the system in rebooted, you can follow the standard Sys V procedure of creating start/stop shell scripts in the /etc/rc.d/* directories. I created the following two scripts:
One moves the system from run level 2 to run level 3. The second, starts both Samba and Tomcat. All of the startup scripts we create run at run level 3. (That's our convention, not a requirement.) The directory /etc/rc2.d/samples on most AIX systems has a README.txt file and some more sample start/stop scripts.
Script #1 - /etc/rc.d/rc2.d/S99jay
Code:
#!/bin/ksh
##################################################
# name: S99jay
# purpose: script to kick the system to run level 3
##################################################
case "$1" in
start )
telinit 3
;;
stop )
;;
* )
echo "Usage: $0 (start | stop)"
exit 1
esac
Script #2 - /etc/rc.d/rc2.d/S70jay
Code:
#!/bin/ksh
##################################################
# name: S70jay
# purpose: script to start both the wkiki and samba
##################################################
case "$1" in
start )
/usr/local/samba/bin/smbd -D
ERROR=$?
/usr/local/samba/bin/nmbd -D
ERROR2=$?
if [ $ERROR2 -ne 0 ]
then
ERROR=1
fi
return $ERROR
/z/tomcat/jakarta-tomcat-4.1.31/bin/startup.sh &
;;
stop )
;;
* )
echo "Usage: $0 (start | stop)"
exit 1
esac