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