]>
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 | ||
c7424bae JR |
33 | if [ "$1" != "stop" ]; then |
34 | check_portmapper || { nls "Error: portmap isn't running" && exit 0; } | |
35 | fi | |
36 | ||
cb4db9e5 | 37 | start() { |
4e8fe8cb | 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 | |
cb4db9e5 ER |
47 | } |
48 | ||
49 | stop() { | |
4e8fe8cb | 50 | # Stop daemons. |
3c93ebeb | 51 | if [ -f /var/lock/subsys/famd ]; then |
4e8fe8cb | 52 | msg_stopping "File Alteration Monitor" |
3c93ebeb JR |
53 | killproc famd |
54 | rm -f /var/lock/subsys/famd > /dev/null 2>&1 | |
4e8fe8cb JR |
55 | else |
56 | msg_not_running "File Alteration Monitor" | |
57 | fi | |
cb4db9e5 ER |
58 | } |
59 | ||
60 | RETVAL=0 | |
61 | # See how we were called. | |
62 | case "$1" in | |
63 | start) | |
64 | start | |
65 | ;; | |
66 | stop) | |
67 | stop | |
4e8fe8cb JR |
68 | ;; |
69 | status) | |
3c93ebeb | 70 | status famd |
4e8fe8cb JR |
71 | exit $? |
72 | ;; | |
73 | restart|force-reload) | |
cb4db9e5 ER |
74 | stop |
75 | start | |
4e8fe8cb JR |
76 | ;; |
77 | *) | |
78 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
79 | exit 3 | |
80 | esac | |
81 | ||
82 | exit $RETVAL |