wok-6.x view get-softmodem-driver/stuff/martian.init @ rev 7897
Up: module-init-tools 1.12
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sun Jan 09 14:07:48 2011 +0100 (2011-01-09) |
parents | 778f75d8af14 |
children | e26a09e68fcb |
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 [ -f $PIDFILE ] ; 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 [ ! -f $PIDFILE ] ; 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 [ ! -f $PIDFILE ] ; 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