]> git.pld-linux.org Git - packages/cachefilesd.git/blame - cachefilesd.init
2.6.30 is first pld tag
[packages/cachefilesd.git] / cachefilesd.init
CommitLineData
46473e89
ER
1#!/bin/sh
2#
3# cachefilesd Start up and shut down the cachefilesd daemon
4#
5# chkconfig: 345 13 87
6#
7# description: Starts user-level daemon that manages the caching files \
8# used by Network Filsystems
9#
10# processname: cachefilesd
11# config: /etc/cachefilesd.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# Check that networking is up.
21if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23 msg_network_down "CacheFiles Daemon"
24 exit 1
25 fi
26else
27 exit 0
28fi
29
30# Set defaults
31CONFFILE=/etc/cachefilesd.conf
32PIDFILE=/var/run/cachefilesd.pid
33OPTIONS="-f $CONFFILE"
34
35# Get service config - may override defaults
36[ -f /etc/sysconfig/cachefilesd ] && . /etc/sysconfig/cachefilesd
37
38start() {
39 # Check if the service is already running?
40 if [ -f /var/lock/subsys/cachefilesd ]; then
41 msg_already_running "CacheFiles Daemon"
42 return
43 fi
44
45 msg_starting "CacheFiles Daemon"
46 modprobe -qs cachefiles
47 daemon --pidfile=$PIDFILE /usr/sbin/cachefilesd $OPTIONS
48 RETVAL=$?
49 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cachefilesd
50}
51
52stop() {
53 if [ ! -f /var/lock/subsys/cachefilesd ]; then
54 msg_not_running "CacheFiles Daemon"
55 return
56 fi
57
58 # Stop daemons.
59 msg_stopping "CacheFiles Daemon"
60 killproc --pidfile $PIDFILE cachefilesd -TERM
61 rm -f /var/lock/subsys/cachefilesd
62}
63
64condrestart() {
65 if [ ! -f /var/lock/subsys/cachefilesd ]; then
66 msg_not_running "CacheFiles Daemon"
67 RETVAL=$1
68 return
69 fi
70
71 stop
72 start
73}
74
75RETVAL=0
76# See how we were called.
77case "$1" in
78 start)
79 start
80 ;;
81 stop)
82 stop
83 ;;
84 restart)
85 stop
86 start
87 ;;
88 try-restart)
89 condrestart 0
90 ;;
91 force-reload)
92 condrestart 7
93 ;;
94 status)
95 status --pidfile $PIDFILE cachefilesd
96 RETVAL=$?
97 ;;
98 *)
99 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
100 exit 3
101esac
102
103exit $RETVAL
This page took 0.072802 seconds and 4 git commands to generate.