Skip to content

Instantly share code, notes, and snippets.

@reyoung
Last active December 13, 2015 21:09
Show Gist options
  • Save reyoung/4975424 to your computer and use it in GitHub Desktop.
Save reyoung/4975424 to your computer and use it in GitHub Desktop.
MoinMoin Init.d service script
#!/bin/bash
#
# chkconfig: 35 90 12
# description: moin server
#
. /etc/init.d/functions
LOCK_FILE=/var/lock/subsys/Moin
MOIN_HOME=/home/wiki/moin-1.9.6
LOG=/var/log/Moin.log
MOIN_USER=wiki
start(){
echo -n Starting Moin Server:
su -l wiki -c "$MOIN_HOME/wikiserver.py" >> $LOG 2>&1 &
pid=`jobs -p`
touch $LOCK_FILE
echo $pid > $LOCK_FILE
success $"Moin Start Up"
echo
}
stop(){
echo -n Stopping Moin server:
pid=`cat $LOCK_FILE`
kill $pid
### Now, delete the lock file ###
rm -f $LOCK_FILE
success $"Moin Stop"
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status Moin
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment