~nchohan/appscale/zk3.3.4

461 by Jonathan Kupferman
Integrated AppMonitoring so that it starts up automatically with AppScale.
1
#!/bin/sh
2
# /etc/init.d/appscale-monitoring
3
# Chris Bunch
4
### BEGIN INIT INFO
5
# Provides: appscale
6
# Required-Start: $network
7
# Required-Stop:
8
# Default-Start: 2 3 4 5
9
# Default-Stop:  0 1 6
10
# Short-Description: AppScale AppMonitoring service
11
# Description:       AppScale AppMonitoring service
12
### END INIT INFO
13
14
#PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
15
. /etc/profile
16
. /lib/lsb/init-functions
17
18
if [ -e /usr/bin/god ]; then
19
  GOD=/usr/bin/god
20
elif [ -e /var/lib/gems/1.8/bin/god ]; then
21
  GOD=/var/lib/gems/1.8/bin/god
22
else
23
  log_failure_msg "god command not found."
24
  exit 1
25
fi
26
27
GOD_PORT=17166
28
# this is needed for integrated tools.
29
export HOME=`cd ${APPSCALE_HOME}/..;pwd`
30
31
case "$1" in
32
  start)
33
    log_begin_msg "Starting AppScale AppMonitoring.."
34
    ${GOD} -c ${APPSCALE_HOME}/AppMonitoring/config/global.god -p ${GOD_PORT}
35
    echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts 
36
    log_end_msg 0
37
    ;;
38
  stop)
39
    log_begin_msg "Stopping AppScale AppMonitoring.."
283.1.282 by NOMURA Yoshihide
fix monitoring service to stop correctly.
40
    ${GOD} stop monitoring -p ${GOD_PORT}
41
    ${GOD} quit -p ${GOD_PORT}
461 by Jonathan Kupferman
Integrated AppMonitoring so that it starts up automatically with AppScale.
42
#    pkill -9 god
43
    log_end_msg 0
44
    ;;
45
  *)
46
    echo "Usage: /etc/init.d/appscale-monitoring {start|stop}"
47
    exit 1
48
    ;;
49
esac