updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / cachefilesd / cachefilesd
blob4624369c9e51e5b763e8639ccb3a9a1e56715f47
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 pidfile="/run/cachefilesd.pid"
8 get_pid() {
9 if [ -r "${pid_file}" ]; then
10 cat "${pid_file}"
11 else
12 pgrep -f /sbin/cachefilesd
16 PID=$(get_pid)
18 case "$1" in
19 start)
20 stat_busy "Starting cachefilesd"
21 modprobe cachefiles 2>/dev/null
22 [[ -z "$PID" ]] && /sbin/cachefilesd -p "$pidfile"
23 if (( $? > 0 )); then
24 stat_fail
25 else
26 add_daemon cachefilesd
27 stat_done
30 stop)
31 stat_busy "Stopping cachefilesd"
32 [[ ! -z "$PID" ]] && kill $PID &> /dev/null
33 if (( $? > 0 )); then
34 stat_fail
35 else
36 rm -f "$pidfile"
37 rm_daemon cachefilesd
38 stat_done
41 restart)
42 $0 stop
43 sleep 0.5
44 $0 start
47 echo "usage: $0 {start|stop|restart}"
48 esac
49 exit 0