Auto start phpvirtualbox VMs on server reboot

NethServer Version: 7.6.1810
Module: phpvirtualbox

I am new to Nethserver. After working with phpvirtualbox and trying to install ERPNext VM.
Login and importing official ERPNext VM was succesfull after following:

My goal was to achieve autostart vms when server reboot.
After following this link, I was able to create pausevms and resumevms scripts :

modified pausevms script:

# Pause running VMs
# Clear the previous status file if it exists
if [ -e $STATUSFILE ]; then rm $STATUSFILE; fi

# List all VMs
for VM in $(sudo -H -u vboxweb vboxmanage list vms | rev | cut -d' ' -f1 | rev)
    # Get VM state
    STATE=$(sudo -H -u vboxweb vboxmanage showvminfo $VM --machinereadable | grep "VMState=" | cut -d'=' -f2)
    # Pause if state is running or paused, write to status file
    if [[ $STATE == \"running\" || $STATE == \"paused\" ]]; then
        sudo -H -u vboxweb vboxmanage controlvm $VM savestate
    # No need to restart paused vm's; just let them remain saved.
    if [[ $STATE == \"running\" ]]; then echo "$VM">>$STATUSFILE; fi

modified resuemvms script:

# Restart VMs saved earlier


# If no status file exists then apparently there are no VMs to resume.
if [ ! -f $STATUSFILE ]; then exit; fi

while read VM; do
    sudo -H -u vboxweb vboxmanage startvm $VM --type headless

On server shutdown the created pausevms script worked well with the help of this link:

commands to configure shutdown script:

vi /etc/e-smith/events/actions/pausevms
chmod +x /etc/e-smith/events/actions/pausevms
ln -s /etc/e-smith/events/actions/pausevms /etc/e-smith/events/system-shutdown/S15pausevms

Same method used to configure resumevms on server reboot, but it didn’t work:

vi /etc/e-smith/events/actions/resumevms
chmod +x /etc/e-smith/events/actions/resumevms
ls -s /etc/e-smith/events/actions/resumevms /etc/e-smith/events/system-init/S99resumevms

kindly support how can I configure the resumevms script to auto run on sever reboot?

1 Like

Hi @Mohanadab and welcome to the NethServer community.
You picked a not so much used module for your first question. However, we will try to help you with this.
@support_team Do you have any ideas to help him?

I found this link that might be of use: but at first glance, the tips in the link are already available in your usecase?

Sorry for long delay,
I don’t have installed php vbox, but perhaps the following link could help.

1 Like

i tried, but no luck.
Is there a procedure working to start vms at boot?
thank you.

1 Like

I’m going to bump this. I’m having the same issue.