How to start stop AOLserver using Daemontools
Original idea taken from OpenACS document Chapter 6. Production Environments [1]
Requirements
Daemontools [2]
Configuration Steps:
1. Download and install Daemontools. Make sure svscanboot is started from inittab. Check if your inittab contains svscanboot. For example:
SV:123456:respawn:/command/svscanboot
2. Create service directory for your AOLserver instance
mkdir /service/YOUR-AOLserver or /var/service/YOUR-AOLserver
Once created you'll also see supervise directory under it.
3. Now create a script named arun under above directory.
#!/bin/sh exec /usr/local/aolserver/bin/nsd -it /usr/local/aolserver/YOUR-AOLserver/etc/config.tcl -u USERNAME -g GROUPNAME
4. Make arun script executable:
chmod +x arun
5. Execute arun script and confirm that it starts your server
./arun
6. If all is fine now rename the arun to run so that it gets picked up by Daemontools:
mv arun run
7. check process list for your nsd YOUR-AOLserver process.
ps -ef |grep nsd
Addon: Using init.d/YOUR-AOLserver script to stop/start/restart/status
#!/bin/sh # # YOUR-AOLserver This shell script takes care of starting and stopping # YOUR-AOLserver # # chkconfig: 345 65 35 # description: YOUR-AOLserver is a web server based on AOLserver # Source function library. . /etc/rc.status # Check Argument case "$1" in start) svc -u /service/YOUR-AOLserver ;; stop) svc -d /service/YOUR-AOLserver ;; status) svstat /service/YOUR-AOLserver ;; restart) "$0" stop sleep 1 "$0" start ;; *) echo "Usage: YOUR-AOLserver {start|stop|restart|status}" exit 1 esac exit 0
Now YOUR-AOLserver can be start, stop, restart, staus using:
/etc/init.d/YOUR-AOLserver stop /etc/init.d/YOUR-AOLserver start /etc/init.d/YOUR-AOLserver restart /etc/init.d/YOUR-AOLserver status