3 # Bumblebee daemon handler script. ArchLinux script to start/stop daemon.
9 PIDFILE
=/var
/run
/$NAME.pid
12 # Start the daemon only if there is not another instance running
13 stat_busy
"Starting Bumblebee"
14 "$BIN" --status >/dev
/null
16 0) ;; # already running
17 1) ;; # already running and X is available
18 3) ;; # already running, but X server cannot be started
20 "$BIN" -d >/dev
/null
2>&1 &
30 # Stop the daemon only if there is an instance running
31 stat_busy
"Stopping Bumblebee"
32 "$BIN" --status >/dev
/null
34 0|
1|
3) # Alive and running
35 local pid
=$
(cat $PIDFILE)
36 kill -TERM $pid >/dev
/null
37 # give it time to end gracefully...
39 while [ $retries -gt 0 ]; do
40 retries
=$
(expr $retries - 1)
41 "$BIN" --status >/dev
/null
46 *) # no need for polling anymore
51 # ... otherwhise just terminate it.
52 "$BIN" --status >/dev
/null
54 0|
1|
3) # still alive > Kill
55 kill -KILL $pid >/dev
/null
89 echo "Usage: $0 {start|stop|restart}"