summaryrefslogtreecommitdiffstats
path: root/system/qemu-guest-agent/rc.qemu-ga
blob: 54043e90263a5f2983130234c1ec526e4eab0cba (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
40
41
42
43
44
45
#!/bin/sh

################################################################################
qemu_ga_start() {
################################################################################
  if [ -n "$(pidof qemu-ga)" ]; then
    echo "qemu-ga seems to be already running."
    return
  fi

  /usr/bin/qemu-ga -d
}

################################################################################
qemu_ga_stop() {
################################################################################
  if [ -z "$(pidof qemu-ga)" ]; then
    echo -e "qemu-ga does not seem to be running."
    return
  fi

  kill $(pidof qemu-ga)
}

################################################################################
qemu_ga_restart() {
################################################################################
  qemu_ga_stop
  sleep 1
  qemu_ga_start
}

case "$1" in
'start')
  qemu_ga_start
  ;;
'stop')
  qemu_ga_stop
  ;;
'restart')
  qemu_ga_restart
  ;;
*)
  echo "usage: $0 start|stop|restart"
esac