301
|
1 #!/bin/sh
|
469
|
2 # $Id: init 615 2003-08-31 15:16:28Z godisch $
|
301
|
3
|
371
|
4 set -e
|
373
|
5
|
|
6 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
|
374
|
7 NOFFLE="/usr/bin/noffle"
|
373
|
8
|
|
9 help () {
|
|
10 echo "Usage: /etc/init.d/noffle { online | offline }" >&2
|
|
11 }
|
|
12
|
|
13 if [ ! -x "$NOFFLE" ]; then
|
469
|
14 # echo "Cannot execute noffle: program not found." >&2
|
|
15 # exit 5 # LSB: program is not installed
|
|
16 exit 0 # Debian policy: exit quietly, see #206928
|
373
|
17 fi
|
|
18
|
|
19 if [ "$2" ]; then
|
|
20 help
|
|
21 exit 2 # LSB: invalid or excess argument(s)
|
|
22 fi
|
301
|
23
|
|
24 if [ -x /usr/sbin/pppd ]; then
|
|
25 NOFFLE_FETCHMODE="ppp"
|
|
26 else
|
|
27 NOFFLE_FETCHMODE="cron"
|
|
28 fi
|
371
|
29 if [ -f /etc/default/noffle ]; then
|
|
30 . /etc/default/noffle
|
|
31 fi
|
301
|
32
|
|
33 case "$1" in
|
|
34 start)
|
452
|
35 echo "Initializing offline news server..."
|
334
|
36 if [ "$NOFFLE_FETCHMODE" = ppp ]; then
|
442
|
37 "$NOFFLE" --offline
|
334
|
38 else
|
442
|
39 "$NOFFLE" --online
|
334
|
40 fi
|
452
|
41 echo "Done."
|
301
|
42 ;;
|
|
43 stop)
|
452
|
44 echo "Switching offline news server into offline mode..."
|
442
|
45 "$NOFFLE" --offline
|
452
|
46 echo "Done."
|
373
|
47 ;;
|
|
48 restart)
|
435
|
49 echo "No action done, as noffle is restarted upon each query."
|
301
|
50 ;;
|
373
|
51 reload|force-reload)
|
435
|
52 echo "No action done, as noffle reloads its configuration upon each query."
|
373
|
53 ;;
|
|
54 status)
|
|
55 help
|
|
56 exit 4 # LSB: program or service status is unknown
|
|
57 ;;
|
|
58 online|offline)
|
452
|
59 echo "Switching offline news server into $1 mode..."
|
442
|
60 "$NOFFLE" --$1
|
452
|
61 echo "Done."
|
301
|
62 ;;
|
|
63 *)
|
373
|
64 help
|
|
65 exit 2 # LSB: invalid or excess argument(s)
|
301
|
66 esac
|
|
67
|
|
68 exit 0
|