Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # etherpad-lite - this script starts and stops the etherpad light daemon
- #
- # chkconfig: - 64 36
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 2 3 4 6
- # Required-Start:
- # description: etherpad lite is a collaboration editor
- # processname: node
- # config: /srv/etherpad-lite/settings.json
- # pidfile: none
- # lockfile: /var/lock/subsys/etherpad-light
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- # Check that networking is up.
- [ "$NETWORKING" = "no" ] && exit 0
- progname="Etherpad Lite"
- path="/home/etherpad/etherpad-lite"
- prog="/usr/local/bin/node"
- parameter="node_modules/ep_etherpad-lite/node/server.js"
- log="$path/log/error.log"
- conf="$path/settings.json"
- user="etherpad"
- lockfile="/var/lock/subsys/etherpad-light"
- logpath=$(dirname $log)
- start() {
- [ -x $prog ] || exit 5
- [ -f $conf ] || exit 6
- [ -d $logpath ] || mkdir $logpath
- [ -f $log ] || touch $log
- chown $user $logpath
- chown $user $log
- echo -n $"Starting $progname: "
- daemon --user=$user "cd $path; $prog $parameter >>$log &"
- retval=$?
- echo
- [ $retval -eq 0 ] && touch $lockfile
- return $retval
- }
- stop() {
- echo -n $"Stopping $progname: "
- killproc $prog
- retval=$?
- echo
- [ $retval -eq 0 ] && rm -f $lockfile
- return $retval
- }
- restart() {
- stop
- start
- }
- rh_status() {
- status $prog
- }
- rh_status_q() {
- rh_status >/dev/null 2>&1
- }
- case "$1" in
- start)
- rh_status_q && exit 0
- $1
- ;;
- stop)
- rh_status_q || exit 0
- $1
- ;;
- restart)
- $1
- ;;
- status)
- rh_status
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart}"
- exit 2
- esac
Add Comment
Please, Sign In to add comment