[CalendarServer-users] launch at startup on Ubuntu

jean jduffas1 at free.fr
Tue Jan 15 09:26:38 PST 2008


hello,

I try to launch CalendarServer at startup, but it doesn' t work...
I use the rc2.d to link the init.d script,

here is my script witch is in init.d :

#!/bin/sh
# Apple CalendarServer startup script, taken from an Ubuntu script.

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Apple Calendar Server"
NAME=calendarserver
DAEMON=/home/fit/CalendarServer/run
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
CACHEDIR=/var/cache/$NAME
CALUSER=root
CALOPTIONS='-d'

#
#       Function that starts the daemon/service.
#
d_start() {
         start-stop-daemon --start --quiet \
                 --chuid $CALUSER \
                 --pidfile $PIDFILE \
                 --exec $DAEMON \
                 --background \
                 --make-pidfile \
                 -- \


}

d_start_direct() {
         start-stop-daemon --start --quiet \
                 --chuid $CALUSER \
                 --pidfile $PIDFILE \
                 --exec $DAEMON \
                 -- \
                 $CALOPTIONS
}

#       Function that stops the daemon/service.
#
d_stop() {
         start-stop-daemon --stop --pidfile $PIDFILE --name $NAME
}

#
#       Function that sends a SIGHUP to the daemon/service.
#
d_reload() {
         start-stop-daemon --stop --quiet --pidfile $PIDFILE \
                 --name $NAME --signal 1
}

case "$1" in
   start)
         echo -n "Starting $DESC"
         d_start
         echo "."
         ;;
   stop)
         echo -n "Stopping $DESC"
         d_stop
         echo "."
         ;;
   restart|force-reload)
         #
         #       If the "reload" option is implemented, move the   
"force-reload"
         #       option to the "reload" entry above. If not, "force-  
reload" is
         #       just the same as "restart".
         #
         echo -n "Restarting $NAME"
         d_stop
         sleep 1
         d_start
         echo "."
         ;;
   *)
         # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-  
reload}" >&2
         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
         exit 1
         ;;
esac

exit 0


More information about the calendarserver-users mailing list