Hi,
I am running Virtualbox host on Debian 9 with a Windows guest/
Two questions:
1. When my Windows guest is running, ifconfig shows the vboxnet1 is up.
Is there a way to script starting this network so that it is up without me starting VirtualBox? I know it isn't going to "do" anything without Virtualbox running, but if I could have the network name up and the IP allocated that would be enough.
2. Is there a way to run a script on the HOST when the Guest is started. i.e. My Windows guest is started, then something.sh is executed on the Linux host side?
Thanks much!
Mark
VirtualBox start with script / Run script on host when guest starts?
-
- Site Moderator
- Posts: 27329
- Joined: 22. Oct 2010, 11:03
- Primary OS: Mac OS X other
- VBox Version: PUEL
- Guest OSses: Win(*>98), Linux*, OSX>10.5
- Location: Greece
Re: VirtualBox start with script / Run script on host when guest starts?
- No, it doesn't make sense if there is no VM that requires that network. In my tests (OSX host), once a VM that requires the HostOnly network has run, the IP will be allocated, even if all VirtualBox processes have exited.
- How about starting the guest from the script and then execute whatever you want from the script?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Re: VirtualBox start with script / Run script on host when guest starts?
Thanks, Socratis, I appreciate the ideas.socratis wrote:
- No, it doesn't make sense if there is no VM that requires that network. In my tests (OSX host), once a VM that requires the HostOnly network has run, the IP will be allocated, even if all VirtualBox processes have exited.
- How about starting the guest from the script and then execute whatever you want from the script?
A little more background: I have a script that needs the vboxnet1 network to be up before it can properly start. I could run it from cron every few minutes and and check if vboxnet1 is up, but I was looking for a cleaner solution that doesn't involve running the script over and over. Worst case is I will just do that.
I did more digging and thought I had found the answer by putting a script in /etc/NetworkManager/dispatcher.d
Code: Select all
#!/bin/sh -e
echo 1="$1" 2="$2" > /home/mark/nw.txt
exit 0
Thanks again,
Mark