updated on Sun Jan 15 20:01:04 UTC 2012
[aur-mirror.git] / automatic / automaticd.rc
blobf7fd022cbcf5d12b2c655a8b01e8773b9e52eb27
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/automaticd
7 PID=`pidof -o %PPID /usr/bin/automatic`
8 case "$1" in
9 start)
10 stat_busy "Starting Automatic Daemon"
11 [ -z "$PID" ] && su -l -s /bin/sh -c "/usr/bin/automatic $AUTOMATICD_ARGS" $AUTOMATICD_USER
12 if [ $? -gt 0 ]; then
13 stat_fail
14 else
15 add_daemon automaticd
16 stat_done
19 stop)
20 stat_busy "Stopping Automatic Daemon"
21 [ ! -z "$PID" ] && kill $PID &> /dev/null
22 if [ $? -gt 0 ]; then
23 stat_fail
24 else
25 rm_daemon automaticd
26 stat_done
29 restart)
30 $0 stop
31 while [ ! -z "$PID" -a -d "/proc/$PID" ]; do sleep 1; done
32 $0 start
35 echo "usage: $0 {start|stop|restart}"
36 esac
37 exit 0