blob: c456e51c9efae1cc49f30ee4df2edc46455efe8c [file] [log] [blame]
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +05301#!/bin/bash
2# chkconfig: 2345 98 11
3# description: File Integrity Checking Daemon
4#
5# processname: yule
6# config : /etc/yulerc
7# logfile : /var/log/yule/yule_log
8# database: /var/lib/yule/yule_file
9#
10
11NAME=yule
12DAEMON=/usr/sbin/yule
13RETVAL=0
14PIDFILE=/var/run/yule.pid
15
16. /etc/default/rcS
17
18. /etc/default/samhain-server
19
20if [ "x$SAMHAIN_SERVER_START" != "xyes" ]; then
21 echo "${0}: server disabled in /etc/default/samhain-server"
22 exit 0
23fi
24
25if [ -x $DAEMON ]; then
26 :
27else
28 echo "${0}: executable ${DAEMON} not found"
29 exit 1
30fi
31
32samhain_done()
33{
34 if [ $RETVAL -eq 0 ]; then
35 echo "."
36 else
37 echo " failed."
38 fi
39}
40
41log_stat_msg () {
42case "$1" in
43 0)
44 echo "Service $NAME: Running";
45 ;;
46 1)
47 echo "Service $NAME: Stopped and /var/run pid file exists";
48 ;;
49 3)
50 echo "Service $NAME: Stopped";
51 ;;
52 *)
53 echo "Service $NAME: Status unknown";
54 ;;
55esac
56}
57
58case "$1" in
59 start)
60 #
61 # Remove a stale PID file, if found
62 #
63 if test -f ${PIDFILE}; then
64 /bin/rm -f ${PIDFILE}
65 fi
66 #
67 echo -n "Starting ${NAME}"
68 start-stop-daemon --start --quiet --exec $DAEMON
69 RETVAL=$?
70 samhain_done
71 ;;
72
73 stop)
74 echo -n "Stopping $NAME"
75 start-stop-daemon --stop --quiet --exec $DAEMON
76 RETVAL=$?
77
78 #
79 # Remove a stale PID file, if found
80 #
81 if test -f ${PIDFILE}; then
82 /bin/rm -f ${PIDFILE}
83 fi
84 if test -S /var/run/${NAME}.sock; then
85 /bin/rm -f /var/run/${NAME}.sock
86 fi
87 samhain_done
88 ;;
89
90 restart)
91 $0 stop
92 sleep 3
93 $0 start
94 RETVAL=$?
95 ;;
96
97 reload|force-reload)
98 echo -n "Reloading $NAME configuration files"
99 start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
100 RETVAL=$?
101 samhain_done
102 ;;
103
104 status)
105 $DAEMON status
106 RETVAL=$?
107 log_stat_msg ${RETVAL}
108 ;;
109
110 *)
111 echo "$0 usage: {start|stop|status|restart|reload}"
112 exit 1
113 ;;
114esac
115
116exit $RETVAL