summaryrefslogtreecommitdiffstats
path: root/recipes-security/samhain/files/samhain-server.init
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2014-08-17 19:11:14 -0700
committerArmin Kuster <akuster808@gmail.com>2014-08-27 21:11:12 -0700
commitf0f670c2fe8cd876eaf2143d7e18ec3eb7d2a641 (patch)
tree19c694b2d1850daf4991049bd2a1a64bc62cbd92 /recipes-security/samhain/files/samhain-server.init
parente6b6816192993b022738d204091348577c8fb45e (diff)
downloadmeta-security-f0f670c2fe8cd876eaf2143d7e18ec3eb7d2a641.tar.gz
samhain: New ISD package
These are the base files needed by both client and server recipes. Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'recipes-security/samhain/files/samhain-server.init')
-rw-r--r--recipes-security/samhain/files/samhain-server.init116
1 files changed, 116 insertions, 0 deletions
diff --git a/recipes-security/samhain/files/samhain-server.init b/recipes-security/samhain/files/samhain-server.init
new file mode 100644
index 0000000..89bd0aa
--- /dev/null
+++ b/recipes-security/samhain/files/samhain-server.init
@@ -0,0 +1,116 @@
1#!/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 /sbin/start-stop-daemon --start --quiet --exec $DAEMON
69 RETVAL=$?
70 samhain_done
71 ;;
72
73 stop)
74 echo -n "Stopping $NAME"
75 ( /sbin/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 /sbin/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