source: trunk/init/samhain.start.in@ 255

Last change on this file since 255 was 1, checked in by katerina, 19 years ago

Initial import

File size: 1.7 KB
Line 
1#!/bin/sh
2
3# This file is public domain and comes with NO WARRANTY of any kind
4# samhain deamon start/stop script.
5
6# This should be put in /etc/init.d (at least on machines SYSV R4
7# based systems) and linked to /etc/rc3.d/S99samhain. When this is done
8# the samhain daemon will be started when the machine is started.
9
10PATH=/sbin:/usr/bin:/usr/sbin:/bin
11basedir=/
12
13prefix=@prefix@
14exec_prefix=@exec_prefix@
15bindir=@bindir@
16
17samhain_daemon_user=root # Run samhain as this user.
18 # If you use this, uncomment one of
19 # the su rows below.
20
21export PATH
22
23mode=$1
24
25# The following test may be removed if this script isn't to be run as root.
26if test ! -w /
27then
28 echo "$0: this script must be run as root ... fatal error"
29 exit 1
30fi
31
32
33# Safeguard (relative paths, core dumps..)
34cd $basedir
35
36case "$mode" in
37 'start')
38 # Start deamon
39 if test -x ${bindir}/samhain
40 then
41 if test -x /sbin/startproc
42 then
43 # use startproc if available
44 startproc ${bindir}/samhain -t check -D
45 else
46 # For Linux
47 su -c -- $samhain_daemon_user $bindir/samhain -t check -D
48 # For sun
49 # su $samhain_daemon_user $bindir/samhain -t check -D
50 fi
51 else
52 echo "Can't execute ${bindir}/samhain"
53 fi
54 ;;
55
56
57 'stop')
58 if test -x ${bindir}/samhain
59 then
60 if test -x /sbin/killproc
61 then
62 # alternatively use the command below, if you have 'killproc'
63 killproc -TERM ${bindir}/samhain
64 else
65 # Stop deamon - no PID file available, so search for the pid
66 SH_PID=`ps aux | grep samhain | grep -v grep | awk '{print $2}'`
67 kill ${SH_PID}
68 fi
69 fi
70 ;;
71
72 *)
73 # usage
74 echo "usage: $0 start|stop"
75 exit 1
76 ;;
77esac
Note: See TracBrowser for help on using the repository browser.