Mercurial > noffle
comparison debian/init @ 373:62b17f6d0269 noffle
[svn] made init script LSB compliant
| author | godisch |
|---|---|
| date | Wed, 02 Apr 2003 22:58:16 +0100 |
| parents | 82457f16cf43 |
| children | 11cca625263f |
comparison
equal
deleted
inserted
replaced
| 372:458aa509ca0f | 373:62b17f6d0269 |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 # $Id: init 511 2003-04-02 11:05:33Z godisch $ | 2 # $Id: init 513 2003-04-02 21:58:16Z godisch $ |
| 3 | 3 |
| 4 set -e | 4 set -e |
| 5 | |
| 6 PATH="/bin:/usr/bin:/sbin:/usr/sbin" | |
| 5 NOFFLE=/usr/bin/noffle | 7 NOFFLE=/usr/bin/noffle |
| 6 [ -x "$NOFFLE" ] || exit 0 | 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 | |
| 7 | 22 |
| 8 if [ -x /usr/sbin/pppd ]; then | 23 if [ -x /usr/sbin/pppd ]; then |
| 9 NOFFLE_FETCHMODE="ppp" | 24 NOFFLE_FETCHMODE="ppp" |
| 10 else | 25 else |
| 11 NOFFLE_FETCHMODE="cron" | 26 NOFFLE_FETCHMODE="cron" |
| 13 if [ -f /etc/default/noffle ]; then | 28 if [ -f /etc/default/noffle ]; then |
| 14 . /etc/default/noffle | 29 . /etc/default/noffle |
| 15 fi | 30 fi |
| 16 | 31 |
| 17 case "$1" in | 32 case "$1" in |
| 18 online|offline) | |
| 19 echo "Switching offline news server to $1 mode: noffle." | |
| 20 $NOFFLE --$1 | |
| 21 ;; | |
| 22 start) | 33 start) |
| 23 echo "Initializing offline news server: noffle." | 34 echo -n "Initializing offline news server: noffle" |
| 24 if [ "$NOFFLE_FETCHMODE" = ppp ]; then | 35 if [ "$NOFFLE_FETCHMODE" = ppp ]; then |
| 25 $NOFFLE --offline | 36 $NOFFLE --offline |
| 26 else | 37 else |
| 27 $NOFFLE --online | 38 $NOFFLE --online |
| 28 fi | 39 fi |
| 29 ;; | 40 ;; |
| 30 stop) | 41 stop) |
| 31 $0 offline | 42 echo -n "Switching offline news server into offline mode: noffle" |
| 43 $NOFFLE --offline | |
| 32 ;; | 44 ;; |
| 33 reload|force-reload|restart) | 45 restart) |
| 46 echo -n "Restarting offline news server: noffle" | |
| 47 ;; | |
| 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 | |
| 34 ;; | 58 ;; |
| 35 *) | 59 *) |
| 36 echo "Usage: $0 {start|stop|online|offline}" >&2 | 60 help |
| 37 exit 1 | 61 exit 2 # LSB: invalid or excess argument(s) |
| 38 ;; | 62 ;; |
| 39 esac | 63 esac |
| 64 echo "." | |
| 40 | 65 |
| 41 exit 0 | 66 exit 0 |
