]>
Commit | Line | Data |
---|---|---|
4e8fe8cb JR |
1 | #!/bin/sh |
2 | # | |
3c93ebeb | 3 | # famd FAM, the File Alteration Monitor server |
4e8fe8cb JR |
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. | |
3c93ebeb JR |
9 | # processname: famd |
10 | # pidfile: /var/run/famd.pid | |
4e8fe8cb JR |
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 | |
3c93ebeb | 21 | [ -f /etc/sysconfig/famd ] && . /etc/sysconfig/famd |
4e8fe8cb JR |
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 | # nls "ERROR: Networking is down. %s can't be run." <service> | |
3c93ebeb | 27 | msg_network_down "File Alteration Monitor" |
4e8fe8cb JR |
28 | exit 1 |
29 | fi | |
30 | else | |
31 | exit 0 | |
32 | fi | |
33 | ||
34 | RETVAL=0 | |
35 | # See how we were called. | |
36 | case "$1" in | |
37 | start) | |
38 | # Check if the service is already running? | |
3c93ebeb | 39 | if [ ! -f /var/lock/subsys/famd ]; then |
4e8fe8cb | 40 | msg_starting "File Alteration Monitor" |
3c93ebeb | 41 | daemon famd -T 0 $FAM_OPTS |
4e8fe8cb | 42 | RETVAL=$? |
3c93ebeb | 43 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/famd |
4e8fe8cb JR |
44 | else |
45 | msg_already_running "File Alteration Monitor" | |
46 | fi | |
47 | ;; | |
48 | stop) | |
49 | # Stop daemons. | |
3c93ebeb | 50 | if [ -f /var/lock/subsys/famd ]; then |
4e8fe8cb | 51 | msg_stopping "File Alteration Monitor" |
3c93ebeb JR |
52 | killproc famd |
53 | rm -f /var/lock/subsys/famd > /dev/null 2>&1 | |
4e8fe8cb JR |
54 | else |
55 | msg_not_running "File Alteration Monitor" | |
56 | fi | |
57 | ;; | |
58 | status) | |
3c93ebeb | 59 | status famd |
4e8fe8cb JR |
60 | exit $? |
61 | ;; | |
62 | restart|force-reload) | |
63 | $0 stop | |
64 | $0 start | |
65 | exit $? | |
66 | ;; | |
67 | *) | |
68 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
69 | exit 3 | |
70 | esac | |
71 | ||
72 | exit $RETVAL |