This repository has been archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paper_trail.init.d
81 lines (65 loc) · 1.31 KB
/
paper_trail.init.d
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
#!/bin/bash
### BEGIN INIT INFO
# Provides: remote_syslog
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and Stop
# Description: Runs remote_syslog
### END INIT INFO
# /etc/init.d/remote_syslog
#
# Starts the remote_syslog daemon
#
# chkconfig: 345 90 5
# description: Runs remote_syslog
#
# processname: remote_syslog
prog="remote_syslog"
config="$HOME/bin/remote_syslog_conf.yml"
dates=$(date)
EXTRAOPTIONS=""
RETVAL=0
start(){
echo "$dates : paper_trail daemon starting" >> $HOME/logs/self.log
$prog -c $config $EXTRAOPTIONS
return 0
}
stop(){
echo "Stopping $prog: "
tmp=$(ps -A | grep remote_syslog | wc -l)
if [[ $tmp > 0 ]]; then
echo "found - killed"
kill $(ps -A | grep remote_syslog | awk '{print $1}')
else
echo "not found"
fi
return 0
}
status(){
echo -n $"Checking for process "
tmp=$(ps -A | grep remote_syslog | wc -l)
if [[ $tmp > 0 ]]; then
echo -e '\033[1;32m[ FOUND ]\033[0m'
else
echo "[ not found ]"
fi
return 0
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|status}"
RETVAL=1
esac
exit $RETVAL