forked from rodumani/ARA-Monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitor
executable file
·58 lines (56 loc) · 985 Bytes
/
monitor
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
#!/bin/bash
#
# Ara Monitor
# description: Foo server
# Copyright (c) 2013, Change Jeong.
#
# Author : Changje Jeong <rodumani@sparcs.org>
#
# Start the service
monitor_directory=./
crawler=$monitor_directory/ara.py
start() {
if [ "$(pidof aracrawler)" ]
then
echo "Ara monitor is already running"
exit 1
else
echo "Starting Ara monitor"
$crawler
echo "Ara monitor startup"
fi
}
# Restart the service
stop() {
echo "Stopping Ara Monitor"
if [ "$(pidof aracrawler)" ]
then
kill $(pidof aracrawler)
sleep 1
if [ "$(pidof aracrawler)" ]
then
kill -9 $(pidof aracrawler)
fi
echo "Ara monitor stopped"
else
echo "Ara monitor is not running"
fi
killall twistd
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0