Skip to content

Commit

Permalink
Disallow restart when wifibox is not running.
Browse files Browse the repository at this point in the history
It makes no sense to execute the `restart` command when the guest
is not run.  Emit a warning instead and quit.
  • Loading branch information
pgj committed Sep 30, 2022
1 parent ff81a0b commit 69d726c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sbin/wifibox
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ reload_vmm() {
wifibox_restart() {
local _target="$1"
local _restart
local _pid

log info "Begin: wifibox restart"

Expand All @@ -795,6 +796,13 @@ wifibox_restart() {
exit 1
fi

_pid="$(get_vm_manager_pid)"

if [ -z "${_pid}" ]; then
log warn "No running instance found that could be restarted"
return 1
fi

case ${_target} in
guest) _restart="G";;
""|netif) _restart="GN";;
Expand Down

0 comments on commit 69d726c

Please sign in to comment.