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

Up: slitaz-tools, slitaz-tools-boxes (5.7.2) bugfix
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Apr 16 15:34:54 2014 +0300 (2014-04-16)
parents
children ff5fd8788cd9
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"
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 active_pidfile $PIDFILE martian_modem ; then
26 echo "$NAME already running."
27 exit 1
28 fi
29 echo -n "Starting $DESC: $NAME... "
30 $DAEMON $OPTIONS && echo `/bin/pidof $DAEMON` > $PIDFILE
31 status
32 ;;
33 stop)
34 if ! active_pidfile $PIDFILE martian_modem ; then
35 echo "$NAME is not running."
36 exit 1
37 fi
38 echo -n "Stopping $DESC: $NAME... "
39 killall martian_modem
40 rm $PIDFILE
41 status
42 ;;
43 restart)
44 if ! active_pidfile $PIDFILE martian_modem ; then
45 echo "$NAME is not running."
46 exit 1
47 fi
48 echo -n "Restarting $DESC: $NAME... "
49 killall martian_modem
50 sleep 2
51 $DAEMON $OPTIONS && echo `/bin/pidof $DAEMON` > $PIDFILE
52 status
53 ;;
54 *)
55 echo ""
56 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
57 echo ""
58 exit 1
59 ;;
60 esac
62 exit 0