summaryrefslogtreecommitdiff
path: root/etc/rc.d/vmd
blob: 5db928072bd8766e731d40e4ce6a924a3583887a (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
#!/bin/ksh
#
# $OpenBSD: vmd,v 1.8 2018/07/11 13:19:47 reyk Exp $

daemon="/usr/sbin/vmd"

. /etc/rc.d/rc.subr

# Child will not return a config parsing error to the parent.
rc_pre() {
	${daemon} -n ${daemon_flags}
}

list_running() {
	vmctl status | awk '$2 ~ "[0-9]" {print $8}'
}

rc_stop() {
	for vm in $(list_running); do
		_rc_do vmctl stop "$vm" -w
	done

	pkill -T "${daemon_rtable}" -xf "${pexp}"
}

rc_cmd $1