blob: c8948361adfc0dc2d33ae8890955d9979136e604 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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
|