Initial commit: Uploaded everything from abs/core
[arch-rock.git] / base / glibc / nscd
blob8b14f2a3fad082ba00a880f066787b49588993f4
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 PID=`pidof -o %PPID /usr/sbin/nscd`
7 case "$1" in
8 start)
9 stat_busy "Starting nscd"
10 # create necessary directories if they don't already exist
11 mkdir -p /var/run/nscd /var/db/nscd 2>/dev/null
12 # remove stale files
13 rm -f /var/db/nscd/* /var/run/nscd/* 2>/dev/null
14 [ -z "$PID" ] && /usr/sbin/nscd
15 if [ $? -gt 0 ]; then
16 stat_fail
17 else
18 add_daemon nscd
19 stat_done
22 stop)
23 stat_busy "Stopping nscd"
24 [ ! -z "$PID" ] && kill $PID &> /dev/null
25 if [ $? -gt 0 ]; then
26 stat_fail
27 else
28 rm_daemon nscd
29 stat_done
32 restart)
33 $0 stop
34 sleep 1
35 $0 start
38 echo "usage: $0 {start|stop|restart}"
39 esac
40 exit 0