aboutsummaryrefslogtreecommitdiff
path: root/network/ttdnsd/rc.ttdnsd.new
blob: 39c214a9831d277d9189f24423c929b7e70608ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/sh
#
# ttdnsd    The Tor TCP DNS Daemon
#
# This initscript runs a chrooted ttdnsd process and it makes recursive TCP
# DNS requests through the Tor network.

# This script is a modified version of Jacob Appelbaum's /etc/init.d/ttdnsd
# for use on Slackware.

# Author: Marco Bonetti <sid77@slackware.it>

# Do NOT "set -e"

NAME=ttdnsd
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/ttdnsd.pid
TSOCKS_CONF_FILE=tsocks.conf
export TSOCKS_CONF_FILE

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# This will be overloaded by $DEFAULTS
DAEMON_ARGS="-P $PIDFILE -f /etc/ttdnsd.conf $DEFAULTS"

start() {
  $DAEMON $DAEMON_ARGS
}

stop() {
  kill `cat $PIDFILE`
}

reload() {
  kill -s HUP `cat $PIDFILE`
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  reload)
    reload
    ;;
  restart|force-reload)
    stop
    sleep 1
    start
    ;;
  *)
    echo "Usage: $0 (start|stop|reload|restart|force-reload)"
    ;;
esac