From 79e03079a24140e10433c30ba5a98b69308ac42e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 6 Jun 2013 10:16:51 +0200 Subject: Add debian init script, rename redhat init script appropriatly. Determin JAVA_HOME by readlink query in PATH --- scripts/jabot | 74 ----------------------------------------- scripts/jabot-init-debian | 84 +++++++++++++++++++++++++++++++++++++++++++++++ scripts/jabot-init-redhat | 75 ++++++++++++++++++++++++++++++++++++++++++ scripts/start.jabot.sh | 10 +++--- 4 files changed, 165 insertions(+), 78 deletions(-) delete mode 100755 scripts/jabot create mode 100755 scripts/jabot-init-debian create mode 100755 scripts/jabot-init-redhat diff --git a/scripts/jabot b/scripts/jabot deleted file mode 100755 index 0f676a5..0000000 --- a/scripts/jabot +++ /dev/null @@ -1,74 +0,0 @@ -#! /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 diff --git a/scripts/jabot-init-debian b/scripts/jabot-init-debian new file mode 100755 index 0000000..c894836 --- /dev/null +++ b/scripts/jabot-init-debian @@ -0,0 +1,84 @@ +#! /bin/bash +### BEGIN INIT INFO +# Provides: jabot +# Required-Start: $local_fs $remote_fs $network $syslog $time +# Required-Stop: $local_fs $remote_fs $network $syslog +# Should-Start: apache2 +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: IRC JABot init script +# Description: Init script for jabot services +### END INIT INFO + +# +# jabot Start/Stop the IRC JABot +# +# chkconfig: 345 91 10 +# description: IRC JABot. \ +# processname: jabot +# pidfile: /var/run/jabot.pid + + +# Source function library. +. /lib/lsb/init-functions + +# Check that networking is up. +# [ "${NETWORKING}" = "no" ] && exit 0 + +JABOT_USER=jabot +JABOT_HOME=/srv/$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 +export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:bin/javac::") + +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 diff --git a/scripts/jabot-init-redhat b/scripts/jabot-init-redhat new file mode 100755 index 0000000..7975ee1 --- /dev/null +++ b/scripts/jabot-init-redhat @@ -0,0 +1,75 @@ +#! /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=jabot +JABOT_HOME=/srv/$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 +export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:bin/javac::") + +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 diff --git a/scripts/start.jabot.sh b/scripts/start.jabot.sh index 7b60709..a23a435 100755 --- a/scripts/start.jabot.sh +++ b/scripts/start.jabot.sh @@ -1,8 +1,10 @@ #!/bin/bash -export JABOT_USER=jogl -export JABOT_HOME=/home/$JABOT_USER/jabot + +export JABOT_HOME=/srv/jabot/jabot export JABOT_LOG=$JABOT_HOME/irc_jogamp_CatOut_`date -u +%Y%m%d%H%M`.log -export JAVA_HOME=/opt-linux-x86_64/j2se6 +# JAVA_HOME=/opt-linux-x86_64/j2se6 +JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:bin/javac::") + JAVA=$JAVA_HOME/bin/java nohup nice $JAVA \ -cp $JABOT_HOME/build/jabot.jar org.jogamp.jabot.irc.CatOut \ @@ -10,7 +12,7 @@ nohup nice $JAVA \ -server irc.freenode.net -channel jogamp \ -logrotate 86400000 \ -logrotateStart 0505 \ - -logprefix "/home/jogl/jogamp.org/log/irc/" \ + -logprefix "/srv/www/jogamp.org/log/irc/" \ -urlprefix "http://jogamp.org/log/irc/" \ -htmlHeader $JABOT_HOME/assets/header.html \ -htmlFooter $JABOT_HOME/assets/footer.html \ -- cgit v1.2.3