summaryrefslogtreecommitdiffstats
path: root/scripts/jabot-init-debian
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-06 10:16:51 +0200
committerSven Gothel <[email protected]>2013-06-06 10:16:51 +0200
commit79e03079a24140e10433c30ba5a98b69308ac42e (patch)
tree1642d55fa778a93ca20a7672452b395764bbb50f /scripts/jabot-init-debian
parented3bc488e713b638264a225fb9147f31b9cf4175 (diff)
Add debian init script, rename redhat init script appropriatly. Determin JAVA_HOME by readlink query in PATH
Diffstat (limited to 'scripts/jabot-init-debian')
-rwxr-xr-xscripts/jabot-init-debian84
1 files changed, 84 insertions, 0 deletions
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