summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-17 07:25:14 +0100
committerSven Gothel <[email protected]>2013-01-17 07:25:14 +0100
commit56933ed492d7a8b63eb8aef58f17ec37191b7875 (patch)
tree0b6bd3271e7bf25ccc1e06138c87e73d613daed3
parente4a25a8d84b1991aac8921ff48fef4088e9fdbf3 (diff)
Add start/stop initd scripts
-rwxr-xr-xscripts/jabot74
-rwxr-xr-xscripts/start.jabot.sh17
-rwxr-xr-xscripts/stop.jabot.sh3
3 files changed, 94 insertions, 0 deletions
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
diff --git a/scripts/start.jabot.sh b/scripts/start.jabot.sh
new file mode 100755
index 0000000..f85b92d
--- /dev/null
+++ b/scripts/start.jabot.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+export JABOT_USER=jogl
+export JABOT_HOME=/home/$JABOT_USER/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=$JAVA_HOME/bin/java
+nohup nice $JAVA \
+ -cp $JABOT_HOME/build/jabot.jar org.jogamp.jabot.irc.CatOut \
+ -login jogamp -name CatOut \
+ -server irc.freenode.net -channel jogamp \
+ -logrotate 86400000 \
+ -logprefix "/home/jogl/jogamp.org/irclogs/" \
+ -htmlHeader $JABOT_HOME/assets/header.html \
+ -htmlFooter $JABOT_HOME/assets/footer.html \
+ > $JABOT_LOG 2>&1 &
+
+# 1day = 24 * 60 * 60 * 1000 = 86400000
diff --git a/scripts/stop.jabot.sh b/scripts/stop.jabot.sh
new file mode 100755
index 0000000..6a5ef59
--- /dev/null
+++ b/scripts/stop.jabot.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+kill `ps -ef | grep jabot.jar | grep -v grep | awk '{ print $2 }'`
+