View this PageEdit this PageUploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide

Run as daemon on Linux?

I run a swiki on linux. I'd like to be able to set it up to start up with an init script. The headless option though doesn't release the current terminal once running (which stops the init runing if you try start it here). Shelling a new terminal and then killing it seems to stop the swiki. Anyone know of a way to do this?

David Horwitz
University of Cape Town

Answer: Try using the unix command "NOHUP"

nohup squeak -headless squeak.image &

It will detach it from the terminal window and pipe the output to a file. You should be able to log out afterwards and still leave swiki running. I'm using it now on my Linux Red Hat 9 server.

8/2/2003: i (anonymous user) am not an expert, but after reading the mailing list and other info, i've installed the following init script on RH9, and it seems to be working properly, so i'm documenting it here:

#!/bin/sh
# startup script for ComSwiki
#
# chkconfig: 2345 20 80
# description: start the squeak image

# processname: squeak
#
#
. /etc/rc.d/init.d/functions

case "$1" in
     start)
         (
             echo Starting ComSwiki
             daemon –user comswiki nohup /usr/local/bin/comswiki/squeak -headless /usr/local/bin/comswiki/squeak.image &

         )
         ;;
     stop)
         echo -n Killing ComSwiki
         killproc squeak
         echo
         echo
         ;;
     restart)
         $0 stop;$0 start
         ;;
    )
         echo "Usage: $0 {start|stop|restart}"
         exit 1
esac
exit 0


Install that file as /etc/rc.d/init.d/comswiki
Make sure to set the execution mode correctly:
     root#  chmod 755 comswiki

Link to this Page

  • Swiki FAQ last edited on 7 May 2011 at 6:22 pm by 108-81-8-212.lightspeed.milwwi.sbcglobal.net