forked from zxvdr/scribble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scribble.init
74 lines (65 loc) · 1.52 KB
/
scribble.init
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
#!/bin/sh
#
# Scribble - Scribble is a daemon that sends log files to a Scribe log server.
#
# chkconfig: - 85 15
# description: Scribble is a daemon for streaming log files into a Scribe log
# aggregating server, in real-time.
# Source function library.
. /etc/rc.d/init.d/functions
exec="/usr/sbin/scribble"
prog=$(basename $exec)
config="/etc/scribed/logs.conf"
user="scribe"
group="scribe"
pidfile="/var/run/scribed/scribble.pid"
interval="5.0"
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/scribble
start() {
echo -n $"Starting $prog: "
$exec --daemon --config=$config --user=$user --group=$group --pidfile=$pidfile --interval=$interval
retval=$?
[ $retval -eq 0 ] && success || failure
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
reload() {
status -p $pidfile $prog >/dev/null || exit 7
killproc -p $pidfile $prog -HUP
}
restart() {
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status -p $pidfile $prog
;;
try-restart|condrestart)
if status -p $pidfile $prog >/dev/null ; then
restart
fi
;;
reload)
reload
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|try-restart|force-reload}"
exit 2
esac