wok-stable view get-softmodem-driver/stuff/martian.init @ rev 3478

get-softmodem-driver: packages are now saved in tazwok packages_repository
author Dominique Corbex <domcox@users.sourceforge.net>
date Wed Jun 17 09:49:44 2009 +0200 (2009-06-17)
parents 1f6bff831481
children 778f75d8af14
line source
1 #!/bin/sh
2 # /etc/init.d/martian: Start, stop and restart martian deamon on SliTaz, at boot
3 # time or with the command line.
4 #
5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Martian modem
12 DESC="Agere Systems PCI Modem deamon"
13 DAEMON=/usr/sbin/martian_modem
14 OPTIONS="--daemon $MARTIAN_OPTIONS /dev/ttySM0"
15 PIDFILE=/var/run/martian.pid
16 MODULE="martian_dev"
18 if [ `/sbin/lsmod | grep -c ${MODULE}` -lt "1" ]; then
19 echo "kernel module is not loaded!"
20 exit 1
21 fi
23 case "$1" in
24 start)
25 if [ -f $PIDFILE ] ; then
26 echo "$NAME already running."
27 exit 1
28 fi
29 echo -n "Starting $DESC: $NAME... "
30 $DAEMON $OPTIONS
31 status
32 echo `/sbin/pidof $DAEMON` > $PIDFILE
33 ;;
34 stop)
35 if [ ! -f $PIDFILE ] ; then
36 echo "$NAME is not running."
37 exit 1
38 fi
39 echo -n "Stopping $DESC: $NAME... "
40 kill `cat $PIDFILE`
41 status
42 ;;
43 restart)
44 if [ ! -f $PIDFILE ] ; then
45 echo "$NAME is not running."
46 exit 1
47 fi
48 echo -n "Restarting $DESC: $NAME... "
49 kill `cat $PIDFILE`
50 sleep 2
51 $DAEMON $OPTIONS
52 status
53 echo `/sbin/pidof $DAEMON` > $PIDFILE
54 ;;
55 *)
56 echo ""
57 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
58 echo ""
59 exit 1
60 ;;
61 esac
63 exit 0