]> git.pld-linux.org Git - packages/fam.git/blob - fam.init
- build fixes, release 8.
[packages/fam.git] / fam.init
1 #!/bin/sh
2 #
3 # famd          FAM, the File Alteration Monitor server
4 #
5 # chkconfig:    345 75 25
6 # description:  FAM provides a daemon and an API which applications
7 #               can use to be notified when specific files or directories
8 #               are changed.
9 # processname:  famd
10 # pidfile:      /var/run/famd.pid
11 # config:       /etc/fam.conf
12
13
14 # Source function library
15 . /etc/rc.d/init.d/functions
16
17 # Get network config
18 . /etc/sysconfig/network
19
20 # Get service config
21 [ -f /etc/sysconfig/famd ] && . /etc/sysconfig/famd
22
23 # Check that networking is up.
24 if is_yes "${NETWORKING}"; then
25         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
26                 msg_network_down "File Alteration Monitor"
27                 exit 1
28         fi
29 else
30         exit 0
31 fi
32
33 if [ "$1" != "stop" ]; then
34         check_portmapper || { nls "Error: portmap isn't running" && exit 0; }
35 fi
36
37 start() {
38         # Check if the service is already running?
39         if [ ! -f /var/lock/subsys/famd ]; then
40                 msg_starting "File Alteration Monitor"
41                 daemon famd -T 0 $FAM_OPTS
42                 RETVAL=$?
43                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/famd
44         else
45                 msg_already_running "File Alteration Monitor"
46         fi
47 }
48
49 stop() {
50         # Stop daemons.
51         if [ -f /var/lock/subsys/famd ]; then
52                 msg_stopping "File Alteration Monitor"
53                 killproc famd
54                 rm -f /var/lock/subsys/famd > /dev/null 2>&1
55         else
56                 msg_not_running "File Alteration Monitor"
57         fi
58 }
59
60 RETVAL=0
61 # See how we were called.
62 case "$1" in
63   start)
64         start
65         ;;
66   stop)
67         stop
68         ;;
69   status)
70         status famd
71         exit $?
72         ;;
73   restart|force-reload)
74         stop
75         start
76         ;;
77   *)
78         msg_usage "$0 {start|stop|restart|force-reload|status}"
79         exit 3
80 esac
81
82 exit $RETVAL
This page took 0.047074 seconds and 3 git commands to generate.