Add systemd script

This commit is contained in:
Nick Peng
2018-06-16 02:36:04 +08:00
parent 53df9f7063
commit 7b62739c13
34 changed files with 746 additions and 869 deletions

5
etc/default/smartdns Normal file
View File

@@ -0,0 +1,5 @@
# Default settings for smartdns server. This file is sourced by /bin/sh from
# /etc/init.d/smartdns.
# Options to pass to smartdns
SMART_DNS_OPTS=

77
etc/init.d/smartdns Normal file
View File

@@ -0,0 +1,77 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: smartdns
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start smartdns server
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
SMARTDNS=/usr/sbin/smartdns
PIDFILE=/var/run/smartdns.pid
test -x $SMARTDNS || exit 5
case $1 in
start)
$SMARTDNS $JAIL_SHELL_OPTS
while true; do
if [ -e "$PIDFILE" ]; then
break;
fi
sleep .5
done
PID="`cat $PIDFILE 2>/dev/null`"
if [ -z "$PID" ]; then
echo "start smartdns server failed."
exit 1
fi
if [ ! -e "/proc/$PID" ]; then
echo "start smartdns server failed."
exit 1
fi
echo "start smartdns server success."
;;
stop)
if [ ! -f "$PIDFILE" ]; then
echo "smartdns server is stopped."
exit 0
fi
PID="`cat $PIDFILE 2>/dev/null`"
if [ ! -e "/proc/$PID" ] || [ -z "$PID" ]; then
echo "smartdns server is stopped"
exit 0
fi
kill -TERM $PID
if [ $? -ne 0 ]; then
echo "Stop smartdns server failed."
exit 1;
fi
rm -f $PIDFILE
echo "Stop smartdns server success."
;;
restart)
$0 stop && sleep 1 && $0 start
;;
status)
PID="`cat $PIDFILE 2>/dev/null`"
if [ ! -e "/proc/$PID" ] || [ -z "$PID" ]; then
echo "smartdns server is not running."
exit 1
fi
echo "smartdns server is running."
status=$?
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
;;
esac
exit $status

View File

@@ -0,0 +1,19 @@
# bind
bind [::]:53
cache-size 1024
loglevel error
#server 8.8.8.8
server 114.114.114.114
server 123.207.137.88
server 119.29.29.29
server 223.5.5.5
#BAU DNS
server 223.113.97.99
server 208.67.222.222:5353
server 202.141.178.13:5353
#server 77.88.8.8:53
server 202.141.162.123:53
#server 101.132.183.99:53