Skip to main content

Plone boot and shutdown startup script

November 4, 2008
  • create plone31 executable in /etc/init.d
  • run "chkconfig --add plone31"
  • and "mkdir /var/log/plone31"
#!/bin/sh
#
# Authors: T. Kim Nguyen ([email protected]) 
#
#
# /etc/init.d/plone31
#
### BEGIN INIT INFO
# Provides: plone31
# Required-Start: $local_fs $remote_fs $network 
# X-UnitedLinux-Should-Start: $named $time postgresql sendmail mysql ypclient dhcp radiusd namcd
# Required-Stop: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Plone 3.1
# Description: Start the Plone 3.1 daemon
### END INIT INFO

pname=plone31
logdir=/var/log/plone31

action="$1"

#
# main part 
#
case "$action" in
    start*)
    echo -n "Starting Plone 3.1 "
    cmdline='/opt/Plone-3.1/zinstance/bin/instance start'
    echo -n "($cmdline) "
    eval $cmdline >> $logdir/rc$pname.out 2>&1 
    ;;
    stop)
    echo -n "Shutting down Plone 3.1 "
    cmdline='/opt/Plone-3.1/zinstance/bin/instance stop'
    echo -n "($cmdline) "
    eval $cmdline >> $logdir/rc$pname.out 2>&1 
    ;;
    status)
    echo -n "Status of Plone 3.1 ..."
    cmdline='tail -6 $logdir/rc$pname.out'
    echo "($cmdline) "
    eval $cmdline 
    ;;
    *)
    cat >&2 <<-EOF 
    Usage: $0 <command> 

    where <command> is one of:
       start              - start Plone 3.1
       stop               - stop Plone 3.1
       status             - status of Plone 3.1
       help               - this screen
    EOF
    exit 1
esac