#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

description="A virtual BMC for controlling virtual machines using IPMI commands"
pidfile="/var/run/vbmcd.pid"
command="/usr/bin/vbmcd"
start_stop_daemon_args="--pidfile ${pidfile}"

depend() {
    use net dns logger
    after libvirtd
}

start() {
    ebegin "Starting vbmcd"
    start-stop-daemon --start ${start_stop_daemon_args} --make-pidfile -b --exec ${command} -- --foreground
    eend $?
}

stop() {
    ebegin "Stopping vbmcd"
    start-stop-daemon --stop ${start_stop_daemon_args} --exec ${command}
    eend $?
}