Files
ports/main/libvirt/rc.libvirtd
2023-01-23 14:50:37 +00:00

41 lines
765 B
Bash

#!/bin/sh
#
# /etc/rc.d/libvirtd: start/stop libvirt daemon
#
. /etc/rc.subr
PROG=/usr/sbin/libvirtd
PIDFILE=/var/run/libvirtd.pid
OPTS="-d"
case $1 in
start)
msg "Starting libvirtd daemon..."
start_daemon -p $PIDFILE $PROG $OPTS
;;
stop)
msg "Stopping libvirtd daemon..."
stop_daemon -p $PIDFILE $PROG
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
status_daemon -p $PROG
case $? in
0) echo "$PROG is running with pid $(cat $PIDFILE)" ;;
1) echo "$PROG is not running but the pid file $PIDFILE exists" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart|status]"
;;
esac
# End of file