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

Up slitaz-tools (986)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri May 27 11:43:53 2016 +0200 (2016-05-27)
parents 4aed2b24febc
children
line source
1 #!/bin/sh
2 # /etc/init.d/martian: Start, stop and restart martian daemon 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 daemon')"
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 _ '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 _ '%s is already running.' "$NAME"
27 exit 1
28 fi
29 action 'Starting %s: %s...' "$DESC" "$NAME"
30 $DAEMON $OPTIONS && echo $(/bin/pidof $DAEMON) > $PIDFILE
31 status
32 ;;
33 stop)
34 if ! active_pidfile $PIDFILE martian_modem ; then
35 _ '%s is not running.' "$NAME"
36 exit 1
37 fi
38 action 'Stopping %s: %s...' "$DESC" "$NAME"
39 killall martian_modem
40 rm $PIDFILE
41 status
42 ;;
43 restart)
44 if ! active_pidfile $PIDFILE martian_modem ; then
45 _ '%s is not running.' "$NAME"
46 exit 1
47 fi
48 action 'Restarting %s: %s...' "$DESC" "$NAME"
49 killall martian_modem
50 sleep 2
51 $DAEMON $OPTIONS && echo $(/bin/pidof $DAEMON) > $PIDFILE
52 status
53 ;;
54 *)
55 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
56 newline
57 exit 1
58 ;;
59 esac
61 exit 0