вторник, 25 ноября 2008 г.

archlinux unbound startscript

стартовый скрипт для unbound в archlinux


#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`cat /usr/local/etc/unbound/unbound.pid 2>/dev/null`

case "$1" in
start)
stat_busy "Starting Unbound DNS"
if [ -z "$PID" ]; then
/usr/local/sbin/unbound -c /usr/local/etc/unbound/unbound.conf &
fi
if [ ! -z "$PID" -o $? -gt 0 ]; then
stat_fail
else
add_daemon unbound
stat_done
fi
;;
stop)
stat_busy "Stopping Unbound DNS "
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon unbound
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0