summaryrefslogtreecommitdiff
path: root/libre/virtualbox-libre/vbox-service.rc
blob: c1af2134da5915c5a4e50ff2b001d9638cd1977e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/vbox-service

name=VBoxService
PID=$(pidof -o %PPID $name)

case "$1" in
  start)
    stat_busy "Starting $name service"
    [[ -z "$PID" ]] && ${name} $VBOX_SERVICE_OPTION &>/dev/null \
    && { add_daemon $name; stat_done; } \
    || { stat_fail; exit 1; }
    ;;
  stop)
    stat_busy "Stopping $name service"
    [[ -n "$PID" ]] && kill $PID &>/dev/null \
    && { rm_daemon $name; stat_done; } \
    || { stat_fail; exit 1; }
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  status)
    stat_busy "Checking $name status";
    ck_status $name
    ;;
  *)
    echo "usage: $0 {start|stop|restart|status}"
    exit 1
esac

exit 0

# vim:set ts=2 sw=2 ft=sh et: