aboutsummaryrefslogtreecommitdiffstats
path: root/www/www6to4/files/www6to4.sh
blob: 09ec00218b64f5ad34ffa65a00ec7eaf14bc7e7d (plain) (blame)
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
#!/bin/sh
# $FreeBSD$

if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
    echo "$0: Cannot determine the PREFIX" >&2
    exit 1
fi

WWW6TO4DIR=${PREFIX}/etc/www6to4


case $1 in
start)
    if [ -d ${WWW6TO4DIR} \
         -a -x ${PREFIX}/sbin/www6to4 \
         -a -f ${WWW6TO4DIR}/www6to4.conf ]; then
        : seems OK
    else
        echo >&2 "$0: missing files!"
        exit 1
    fi
    cd ${WWW6TO4DIR}
    su -m nobody -c "${PREFIX}/sbin/www6to4 &" \
        >/dev/null \
    && echo -n " www6to4" \
    || echo " www6to4 FAILED TO START"
    ;;
stop)
    killall www6to4 && echo -n " www6to4"
    ;;
restart)
    $0 stop
    $0 start
    ;;
*)
    echo "Usage: `basename $0` {start|stop}" >&2
    exit 64
    ;;
esac

exit 0