File: init

package info (click to toggle)
wu-ftpd 2.6.2-25
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,776 kB
  • ctags: 1,360
  • sloc: ansic: 18,114; sh: 3,399; yacc: 1,742; perl: 650; makefile: 225
file content (64 lines) | stat: -rw-r--r-- 1,675 bytes parent folder | download
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
58
59
60
61
62
63
64
#!/bin/sh
#
# /etc/init.d/wu-ftpd  --  start/stop the wu-ftpd FTP daemon.

PATH=/bin:/usr/bin:/sbin:/usr/sbin

unset LANG
trap "" 1 15
test -x /usr/sbin/wu-ftpd || exit 0

RUN_DAEMON=yes
WU_OPTIONS="-l"
if [ -f /etc/default/wu-ftpd ]; then
    . /etc/default/wu-ftpd
fi

WU_OPTIONS="-S $WU_OPTIONS"

run_wu="1"

if [ "x$RUN_DAEMON" = "xno" ]; then
    run_wu=0
fi

# check that the FTP service isn't already enabled in inetd
if [ -f /etc/inetd.conf ] && egrep '^ftp[[:space:]][[:space:]]*' /etc/inetd.conf >/dev/null; then
    run_wu=0
fi

for FILE in /etc/xinetd.d/*netd.d; do
    if [ -f $FILE ] && egrep 'server[[:space:]]*=.*ftpd' $FILE > /dev/null; then
        run_wu=0                                                              
    fi
done

case "$1" in
    start)
        if [ "$run_wu" = "1" ]; then
            echo -n "Starting FTP server: wu-ftpd"
            start-stop-daemon --start --quiet --pidfile /var/run/wu-ftpd.pid \
                --exec /usr/sbin/wu-ftpd -- $WU_OPTIONS && echo "."
        fi
        ;;
    stop)
        if [ -f /var/run/wu-ftpd.pid ] && kill -0 `cat /var/run/wu-ftpd.pid` 2>/dev/null; then
            echo -n "Stopping FTP server: wu-ftpd"
            kill -3 `cat /var/run/wu-ftpd.pid` >/dev/null 2>&1 && echo "."
        fi
        ;;
    restart|force-reload)
        if [ "$run_wu" = "1" ]; then
            echo -n "Restarting FTP server: wu-ftpd"
            $0 stop >/dev/null && echo -n "."
            sleep 2 && echo -n "."
            $0 start >/dev/null && echo ".done."
        fi
        ;;
    *)
        echo "Usage: /etc/init.d/wu-ftpd {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0