Created
July 13, 2009 13:18
-
-
Save btbytes/146105 to your computer and use it in GitHub Desktop.
Init script for Plone on Debian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -e | |
| # Start/stop Zope/Plone server instance | |
| # | |
| # REF: http://plone.org/documentation/how-to/simple-etc-rc-d-init-d-script-for-zeocluster | |
| # Adapted for Debian paths, current Plone 3.2.2+ version and LSB compliance. | |
| # This init script works for a default 'stand-alone' Plone unified installer | |
| # installation (on a single Zope instance) | |
| # | |
| # create as: /etc/init.d/Plone | |
| # to activate it, run: update-rc.d Plone defaults | |
| ### BEGIN INIT INFO | |
| # Provides: Plone | |
| # Required-Start: $local_fs $remote_fs $network $syslog | |
| # Required-Stop: $local_fs $remote_fs $network $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Start/stop Zope/Plone server instance | |
| ### END INIT INFO | |
| # LSB Source function library | |
| . /lib/lsb/init-functions | |
| RETVAL=0 | |
| # this is for the default install path for Plone | |
| plonepath="/usr/local/Plone/zeocluster/bin" | |
| prog="Plone" | |
| start() { | |
| echo -n $"Starting $prog: " | |
| output=`${plonepath}/plonectl start` | |
| # the return status of plonectl is not reliable, we need to parse | |
| # its output via substring match | |
| if echo $output | grep -q "start"; then | |
| # success | |
| touch /var/lock/$prog | |
| log_success_msg "Plone started successfully" | |
| echo | |
| RETVAL=0 | |
| else | |
| # failed | |
| log_failure_msg "Plone failed to start or was already started" | |
| echo | |
| RETVAL=1 | |
| fi | |
| return $RETVAL | |
| } | |
| stop() { | |
| echo -n $"Stopping $prog: " | |
| output=`${plonepath}/plonectl stop` | |
| if echo $output | grep -q "stop"; then | |
| # success | |
| rm /var/lock/$prog | |
| log_success_msg "Plone stopped successfully" | |
| echo | |
| RETVAL=0 | |
| else | |
| # failed | |
| log_failure_msg "Plone failed to stop or was already stopped" | |
| echo | |
| RETVAL=1 | |
| fi | |
| return $RETVAL | |
| } | |
| restart() { | |
| stop | |
| start | |
| } | |
| case "$1" in | |
| start) | |
| start | |
| ;; | |
| stop) | |
| stop | |
| ;; | |
| status) | |
| echo "Plone Server:" | |
| output=`${plonepath}/plonectl status` | |
| echo $output | |
| ;; | |
| restart) | |
| restart | |
| ;; | |
| condrestart) | |
| [ -e /var/lock/$prog ] && restart | |
| ;; | |
| force-reload) | |
| echo "Plone doesn't support force-reload, use restart instead." | |
| ;; | |
| *) | |
| echo $"Usage: $0 {start|stop|status|restart|condrestart}" | |
| RETVAL=2 | |
| esac | |
| exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment