From 56933ed492d7a8b63eb8aef58f17ec37191b7875 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 17 Jan 2013 07:25:14 +0100 Subject: Add start/stop initd scripts --- scripts/jabot | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 scripts/jabot (limited to 'scripts/jabot') diff --git a/scripts/jabot b/scripts/jabot new file mode 100755 index 0000000..0f676a5 --- /dev/null +++ b/scripts/jabot @@ -0,0 +1,74 @@ +#! /bin/bash +# +# jabot Start/Stop the IRC JABot +# +# chkconfig: 345 91 10 +# description: IRC JABot. \ +# processname: jabot +# pidfile: /var/run/jabot.pid + + +# Source function library. +. /etc/rc.d/init.d/functions + +# Get config. +. /etc/sysconfig/network + +# Check that networking is up. +[ "${NETWORKING}" = "no" ] && exit 0 + +JABOT_USER=jogl +JABOT_HOME=/home/$JABOT_USER/jabot +startup=$JABOT_HOME/scripts/start.jabot.sh +shutdown=$JABOT_HOME/scripts/stop.jabot.sh +export JAVA_HOME=/opt-linux-x86_64/j2se6 + +start(){ + echo -n $"Starting Jabot service: " + su - $JABOT_USER -c $startup + RETVAL=$? + echo +} + +stop(){ + action $"Stopping Jabot service: " + su - $JABOT_USER -c $shutdown + RETVAL=$? + echo +} + +status(){ + numproc=`ps -ef | grep jabot.jar | grep -v "grep jabot.jar" | wc -l` + if [ $numproc -gt 0 ]; then + echo "Jabot is running..." + else + echo "Jabot is stopped..." + fi +} + +restart(){ + stop + start +} + + +# See how we were called. +case "$1" in +start) + start + ;; +stop) + stop + ;; +status) + status + ;; +restart) + restart + ;; +*) + echo $"Usage: $0 {start|stop|status|restart}" + exit 1 +esac + +exit 0 -- cgit v1.2.3