How to start stop AOLserver using Daemontools

From AOLserver Wiki
Jump to navigation Jump to search

Original idea taken from OpenACS document Chapter 6. Production Environments [1]


Daemontools [2]

Configuration Steps:

1. Download and install Daemontools. Make sure svscanboot is started from inittab. Check if your inittab contains svscanboot. For example:


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.

   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


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

   # 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
       echo "Starting..."
       svc -u /service/YOUR-AOLserver
       sleep 2
       "$0" status
       echo "Stopping..."
       svc -d /service/YOUR-AOLserver
       sleep 2
       "$0" status
       svstat /service/YOUR-AOLserver
       "$0" stop
       sleep 1
       "$0" start
       echo "Usage: YOUR-AOLserver {start|stop|restart|status}"
       exit 1
   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