301
|
1 #!/bin/sh
|
373
|
2 # $Id: init 513 2003-04-02 21:58:16Z godisch $
|
301
|
3
|
371
|
4 set -e
|
373
|
5
|
|
6 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
|
371
|
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)
|
373
|
34 echo -n "Initializing offline news server: noffle"
|
334
|
35 if [ "$NOFFLE_FETCHMODE" = ppp ]; then
|
337
|
36 $NOFFLE --offline
|
334
|
37 else
|
337
|
38 $NOFFLE --online
|
334
|
39 fi
|
301
|
40 ;;
|
|
41 stop)
|
373
|
42 echo -n "Switching offline news server into offline mode: noffle"
|
|
43 $NOFFLE --offline
|
|
44 ;;
|
|
45 restart)
|
|
46 echo -n "Restarting offline news server: noffle"
|
301
|
47 ;;
|
373
|
48 reload|force-reload)
|
|
49 echo -n "Reloading offline news server configuration: noffle"
|
|
50 ;;
|
|
51 status)
|
|
52 help
|
|
53 exit 4 # LSB: program or service status is unknown
|
|
54 ;;
|
|
55 online|offline)
|
|
56 echo -n "Switching offline news server into $1 mode: noffle"
|
|
57 $NOFFLE --$1
|
301
|
58 ;;
|
|
59 *)
|
373
|
60 help
|
|
61 exit 2 # LSB: invalid or excess argument(s)
|
301
|
62 ;;
|
|
63 esac
|
373
|
64 echo "."
|
301
|
65
|
|
66 exit 0
|