updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / dnscrypt-proxy / rc.d.script
blob1795bea44665137391bde988a783dd06c33b3abe
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 # source application-specific settings
7 [ -f /etc/conf.d/dnscrypt-proxy ] && . /etc/conf.d/dnscrypt-proxy
9 DNSCRYPT_PIDFILE=${DNSCRYPT_PIDFILE:-/var/run/dnscrypt-proxy.pid}
10 DNSCRYPT_LOGFILE=${DNSCRYPT_LOGFILE:-/var/log/dnscrypt-proxy.log}
11 [ -f ${DNSCRYPT_PIDFILE} ] && PID=`cat ${DNSCRYPT_PIDFILE}`
13 case "$1" in
14 start)
15 stat_busy "Starting dnscrypt-proxy"
16 [ -z "$PID" ] && /usr/sbin/dnscrypt-proxy -p ${DNSCRYPT_PIDFILE} -l ${DNSCRYPT_LOGFILE} -d -u ${DNSCRYPT_USER} \
17 -a ${DNSCRYPT_LOCALIP} -P ${DNSCRYPT_LOCALPORT}
18 if [ $? -gt 0 ]; then
19 stat_fail
20 else
21 add_daemon dnscrypt-proxy
22 stat_done
25 stop)
26 stat_busy "Stopping dnscrypt-proxy"
27 [ ! -z "$PID" ] && kill $PID &> /dev/null
28 if [ $? -gt 0 ]; then
29 stat_fail
30 else
31 rm_daemon dnscrypt-proxy
32 stat_done
35 restart)
36 $0 stop
37 sleep 1
38 $0 start
41 echo "usage: $0 {start|stop|restart}"
42 esac
43 exit 0