]>
Commit | Line | Data |
---|---|---|
4e8fe8cb JR |
1 | #!/bin/sh |
2 | # | |
3 | # fam 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: fam | |
10 | # pidfile: /var/run/fam.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/fam ] && . /etc/sysconfig/fam | |
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> | |
27 | msg_network_down fam | |
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? | |
39 | if [ ! -f /var/lock/subsys/fam ]; then | |
40 | msg_starting "File Alteration Monitor" | |
41 | daemon fam -T0 $FAM_OPTS | |
42 | RETVAL=$? | |
43 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fam | |
44 | else | |
45 | msg_already_running "File Alteration Monitor" | |
46 | fi | |
47 | ;; | |
48 | stop) | |
49 | # Stop daemons. | |
50 | if [ -f /var/lock/subsys/fam ]; then | |
51 | msg_stopping "File Alteration Monitor" | |
52 | killproc fam | |
53 | rm -f /var/lock/subsys/fam > /dev/null 2>&1 | |
54 | else | |
55 | msg_not_running "File Alteration Monitor" | |
56 | fi | |
57 | ;; | |
58 | status) | |
59 | status fam | |
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 |