Search
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Create rc.d script to automatically start Byve vms & shut them down gracefully
All Projects
Outpost Internet Ltd
»
Create rc.d script to automatically start Byve vms & shut them down gracefully
Overview
Activity
Issues
Spent time
Gantt
Calendar
News
Documents
Wiki
Files
Download (821 Bytes)
Files
» stopvmgracefully.sh
Sam Bracewell
, 13/04/2026 03:34 PM
#!/bin/sh
#
# Loop running vms to shutdown
# For each one, send the ACPI shutdown command
# Allow 2 mins for shutdown
# If still has not shut down, kill the Bhyve vm process
# Then destroy the vm
vmname
=
$1
echo
"Attempting to shutdown Bhyve VM
$vmname
gracefully. "
pkill
-TERM
-f
"bhyve:
$vmname
"
# Useful commands
#
# Find the VM PID:
# pgrep -f "bhyve: <vm_name>"
# Send the TERM signal:
# kill -s TERM $(pgrep -f "bhyve: <vm_name>")
# See which vms are running:
#
# ls -F /dev/vmm
# Using ps (Process List)
# You can search for the bhyve processes directly to see which VMs are currently active in the process table:
# ps ax | grep 'bhyve: '
# Using bhyvectl
# You can try to list VMs with the bhyvectl command, although this is usually used for managing individual VMs rather than listing all at once.
« Previous
1
…
6
7
8
9
10
Next »
(8-8/10)
Loading...