I'm trying to make the VM start up automatically at launch of the ASUSTOR server.
I'm using a AS6204T running ADM version 2.6.1.R5H1
I'm brand new to Linux, but I gathered that I would need to create a script under /usr/local/etc/init.d/ that does this
(ref: http://forum.asustor.com/viewtopic.php?f=49&t=1681)
Using ln I setup this symblink file:
Code: Select all
lrwxr-xr-x 1 root root 52 Jun 13 17:58 S99MyServer.sh -> /volume1/Software/_VirtualBox/S99MyServer.sh*
On my old windows server I used this:
Code: Select all
@REM Restore to current snapshot, ignoring any changes
"%VBOX_MSI_INSTALL_PATH%\VBoxManage.exe" snapshot "MyServer" restorecurrent
@REM Start the VirtualBox in headless mode
"%VBOX_MSI_INSTALL_PATH%VBoxHeadless.exe" --startvm "Myserver"
I've tried these lines in the script but that didn't work; also I assume that using sudo with 'root' is pointless and/or bad. Would you want/need to run Virtualbox under root or some other user?
Any help getting this thing work is greatly appreciated.
Code: Select all
#!/bin/sh -e
# Startup Virtualbox on system startup.
# Windows code
# @REM Restore current snapshot
# "%VBOX_MSI_INSTALL_PATH%\VBoxManage.exe" snapshot "MyServer" restorecurrent
# @REM Start the VirtualBox in headless mode
# "%VBOX_MSI_INSTALL_PATH%VBoxHeadless.exe" --startvm "MyServer"
VMUSER="root"
VMNAME="MyServer"
echo "===Reset changes back to snapshot==="
sudo -H -u $VMUSER VBoxManage snapshot "$VMNAME" restorecurrent
sleep 10
echo "===Starting VirtualBox VM==="
sudo -H -u $VMUSER VBoxHeadless startvm "$VMNAME"
# sudo -H -u $VMUSER VBoxManage startvm "$VMNAME" --type headless