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