rfkilld

An rfkill daemon, which runs scripts according to rfkill events.
git clone git://r-36.net/rfkilld
Log | Files | Refs | README | LICENSE

rfkilld (676B)


      1 #!/bin/bash
      2 
      3 . /etc/rc.conf
      4 . /etc/rc.d/functions
      5 . /etc/conf.d/rfkilld
      6 
      7 PID=`pidof -o %PPID /usr/bin/rfkilld`
      8 case "$1" in
      9   start)
     10     stat_busy "Starting rfkilld"
     11     [ -z "$PID" ] && /usr/bin/rfkilld $RFKILLD_ARGS 2>&1
     12     if [ $? -gt 0 ]; then
     13       stat_fail
     14     else
     15       PID=`pidof -o %PPID /usr/bin/rfkilld`
     16       add_daemon rfkilld
     17       stat_done
     18     fi
     19     ;;
     20   stop)
     21     stat_busy "Stopping rfkilld"
     22     [ ! -z "$PID" ]  && kill -KILL $PID &>/dev/null
     23     if [ $? -gt 0 ]; then
     24       stat_fail
     25     else
     26       rm_daemon rfkilld 
     27       stat_done
     28     fi
     29     ;;
     30   restart)
     31     $0 stop
     32     $0 start
     33     ;;
     34   *)
     35     echo "usage: $0 {start|stop|restart}"  
     36 esac
     37 exit 0