source: trunk/init/samhain.startLSB.in@ 344

Last change on this file since 344 was 321, checked in by katerina, 14 years ago

Fix for ticket #240: The samhain_kmem kernel module should be loaded earlier

File size: 2.2 KB
Line 
1#! /bin/sh
2
3### BEGIN INIT INFO
4# Provides: @install_name@
5# Required-Start: $syslog $network
6# Required-Stop: $syslog $network
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: Keep an eye on stuff
10# Description: Keep an eye on stuff
11### END INIT INFO
12
13
14# source function library
15if test -f /lib/lsb/init-functions; then
16. /lib/lsb/init-functions
17else
18 echo "File /lib/lsb/init-functions not found"
19 exit 5
20fi
21
22prefix="@prefix@"
23exec_prefix="@exec_prefix@"
24DAEMON=@sbindir@/@install_name@
25NAME=@install_name@
26
27if test ! -f ${DAEMON}; then
28 log_failure_msg "Service $NAME is not installed"
29 exit 5
30fi
31
32if test "x$2" != "x" && test "x$1" != "xstatus"; then
33 log_failure_msg "Excess arguments $@"
34 exit 2
35fi
36
37log_sh_msg () {
38case "$1" in
39 0)
40 log_success_msg "Service $NAME $2"
41 break;
42 ;;
43 1)
44 log_failure_msg "Service $NAME: Error"
45 break;
46 ;;
47 4)
48 log_failure_msg "Service $NAME: Permission denied"
49 break;
50 ;;
51 5)
52 log_failure_msg "Service $NAME is not installed"
53 break;
54 ;;
55 7)
56 log_failure_msg "Service $NAME is not running"
57 break;
58 ;;
59 *)
60 log_failure_msg "Service $NAME: Error"
61 break;
62 ;;
63esac
64}
65
66log_stat_msg () {
67case "$1" in
68 0)
69 echo "Service $NAME: Running";
70 break;
71 ;;
72 1)
73 echo "Service $NAME: Stopped and /var/run pid file exists";
74 break;
75 ;;
76 3)
77 echo "Service $NAME: Stopped";
78 break;
79 ;;
80 *)
81 echo "Service $NAME: Status unknown";
82 break;
83 ;;
84esac
85}
86
87case "$1" in
88 start)
89 #
90 # Preloaded kernel module
91 #
92 @sh_insmod_pre@
93 #
94 ${DAEMON} start
95 ERRNUM=$?
96 #
97 # The hiding kernel module
98 #
99 if [ $ERRNUM -eq 0 ]; then
100 @sh_insmod_cmd@
101 fi
102 #
103 SH_ACT="started"
104 ;;
105 stop)
106 ${DAEMON} stop
107 ERRNUM=$?
108 if test -f @mylockfile@; then
109 /bin/rm -f @mylockfile@
110 fi
111 if test -S @mylockdir@/${NAME}.sock; then
112 /bin/rm -f @mylockdir@/${NAME}.sock
113 fi
114 SH_ACT="stopped"
115 ;;
116 restart)
117 ${DAEMON} restart
118 ERRNUM=$?
119 SH_ACT="restarted"
120 ;;
121 reload|force-reload)
122 ${DAEMON} reload
123 ERRNUM=$?
124 SH_ACT="reloaded"
125 ;;
126 status)
127 ${DAEMON} status
128 ERRNUM=$?
129 log_stat_msg ${ERRNUM}
130 exit ${ERRNUM}
131 ;;
132 *)
133 log_warning_msg "Usage: @install_name@ {start|stop|restart|(force-)reload|status}"
134 exit 2
135 ;;
136esac
137
138log_sh_msg ${ERRNUM} "${SH_ACT}"
139exit ${ERRNUM}
Note: See TracBrowser for help on using the repository browser.