summaryrefslogtreecommitdiff
path: root/libre/virtualbox-libre/vboxservice.rc
blob: 5a62d69a36a6abe27d31e407c884743cf9a61b5a (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/${0##*/}

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

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

exit 0

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