summaryrefslogtreecommitdiffstats
path: root/system/qemu-guest-agent/rc.qemu-ga
blob: a1a4c1d42ab2b41c8dcbd26e8334ac36a2bee851 (plain)
#!/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 "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