forked from twitter-archive/twitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-twitcher
executable file
·90 lines (75 loc) · 1.43 KB
/
init-twitcher
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
85
86
87
88
89
90
#!/bin/bash
#
# twitcher This starts and stops twitcher.
#
# chkconfig: 345 56 50
# description: Twitcher is a zookeeper watch system.
#
# processname: /usr/sbin/twitcher
# pidfile: /var/run/twitcher.pid
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library.
. /etc/init.d/functions
# Check that we are root ... so non-root users stop here
[ `id -u` = 0 ] || exit 1
# Check to see if the binary exists.
[ -f /usr/sbin/twitcher ] || exit 1
RETVAL=0
prog="twitcher"
start() {
echo -n $"Starting $prog: "
unset HOME MAIL USER USERNAME
daemon $prog --pidfile /var/run/twitcher.pid --verbose --log_to_stdout >> /var/log/twitcher.log 2>&1 &
RETVAL=$?
echo
touch /var/lock/subsys/twitcher
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p /var/run/twitcher.pid python26
RETVAL=$?
echo
rm -f /var/lock/subsys/twitcher
return $RETVAL
}
reload() {
echo -n $"Reloading configuration: "
killproc -p /var/run/twitcher.pid python26 -HUP
RETVAL=$?
echo
return $RETVAL
}
restart() {
stop
start
}
condrestart() {
[ -e /var/lock/subsys/twitcher ] && restart
return 0
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1
esac
exit $RETVAL