updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / freedt / rc.svscan
blobed12562024fff26707e60fda74954815fb0b0ce0
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 PID=`pidof -o %PPID /usr/bin/svscan`
7 case "$1" in
8 start)
9 stat_busy "Starting svscan"
10 # create necessary directories if they don't already exist
11 mkdir -p /service 2>/dev/null
12 [ -z "$PID" ] && /usr/bin/svscan /service &
13 if [ $? -gt 0 ]; then
14 stat_fail
15 else
16 add_daemon svscan
17 stat_done
20 stop)
21 stat_busy "Stopping svscan"
22 [ ! -z "$PID" ] && kill $PID &> /dev/null
23 if [ $? -gt 0 ]; then
24 stat_fail
25 else
26 if [ -e /service/ ]
27 then
28 stat_busy "Stopping services ..."
29 svc -dx /service/*
30 stat_done
32 stat_busy "Stopping service logging ..."
33 svc -dx /service/*/log
34 stat_done
37 rm_daemon svscan
38 stat_done
41 restart)
42 $0 stop
43 [ ! -z "$PID" ] && wait "$PID"
44 $0 start
47 echo "usage: $0 {start|stop|restart}"
48 esac
49 exit 0