Recent Comments
- Spitzenpfeil on Sleep is vital
- robert on PT4115 LED-Square
- abies on PT4115 LED-Square
- robert on ERSA I-Con Nano — A pico review
- Ubi de Feo on ERSA I-Con Nano — A pico review
Archives
Tags
64-pixels adapter AVR bulb customs DSO failure by design fireworks firmware good old days hack happy new year hardware IKEA import lamp lecroy LED light lighting linux MBI5168 modding open source opensuse oscilloscope PCB power supply prototype PWM rant remote RGB RoHS Samtid Seeedstudio SMD soldering teardown trigger upgrade WaveAce 224 weller WS2812B youyueCategories
- Computer / Server (21)
- Dear Diary. (13)
- DIY. (12)
- Electronics. (192)
- Arduino. (44)
- Fix me. (13)
- Soldering & PCBs. (39)
- Software. (11)
- Something Completely Different (10)
- The Dump. (28)
Blogroll
KiCad
Links
My 2µF
Meta
Tag Archives: VirtualBox
VirtualBox mischief – getting rid of too many pesky users
This requires VirtualBox guest additions to be installed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/bash VM_NAME="deb test" MAX_USERS=2 RUNNING_VMS=`VBoxManage list runningvms` OUR_VM_IS_RUNNING=`echo ${RUNNING_VMS} | grep "${VM_NAME}"` if [[ -z ${OUR_VM_IS_RUNNING} ]] then echo -e "VM \"${VM_NAME}\" not running...\nBye!" exit fi LOGGED_IN_USERS=`VBoxManage guestproperty enumerate "${VM_NAME}" | grep "/OS/LoggedInUsers, value" | awk '{split($4,a,","); print a[1]}'` if [[ ${LOGGED_IN_USERS} -gt ${MAX_USERS} ]] then echo "Checking VM: \"${VM_NAME}\"..." echo "${LOGGED_IN_USERS} logged in. Maximum allowed: ${MAX_USERS}" echo "Shutting down \"${VM_NAME}\" ..." VBoxManage controlvm "${VM_NAME}" savestate else echo "Checking VM: \"${VM_NAME}\"..." echo "${LOGGED_IN_USERS} logged in. Maximum allowed: ${MAX_USERS}" echo "Phew ..." fi |
Posted in Computer / Server
Tagged linux, mischief, scripting, VBoxManage, VirtualBox, virtualization
Comments Off on VirtualBox mischief – getting rid of too many pesky users
A bit of VirtualBox scripting – NAT & DHCP
Maybe someone will find it useful…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#!/bin/bash ISO="${HOME}/VirtualBox VMs/__stuff__/ISOs/debian-9.5.0-amd64-netinst.iso" VBoxManage createvm --name "$1" --register --ostype "Linux_64" VBoxManage modifyvm "$1" --memory 1024 --acpi on --cpus 2 --audio none --usbxhci on --ioapic on --vram 16 VBoxManage storagectl "$1" --name "SATA" --add sata --hostiocache on --portcount 2 MEDIUM_UUID=`VBoxManage createmedium disk --filename "$HOME/VirtualBox VMs/$1/$1" --size 8000 --format VDI | awk '{print $4}'` VBoxManage storageattach "$1" --storagectl "SATA" --port 0 --type hdd --medium ${MEDIUM_UUID} --nonrotational on VBoxManage storageattach "$1" --storagectl "SATA" --port 1 --type dvddrive --medium "${ISO}" #VBoxManage storageattach "$1" --storagectl "SATA" --port 1 --type dvddrive --medium emptydrive if [[ -z `VBoxManage list hostonlyifs` ]] then VBoxManage hostonlyif create fi VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0 VBoxManage dhcpserver add --ifname vboxnet0 --ip 192.168.56.3 --netmask 255.255.255.0 --lowerip 192.168.56.100 --upperip 192.168.56.200 --enable VBoxManage modifyvm "$1" --nic1 hostonly VBoxManage modifyvm "$1" --hostonlyadapter1 vboxnet0 VBoxManage natnetwork add --netname natnet1 --network "192.168.16.0/24" --enable VBoxManage natnetwork modify --netname natnet1 --port-forward-4 "ssh:tcp:[127.0.0.1]:6666:[192.168.16.137]:22" VBoxManage dhcpserver add --netname natnet1 --ip 192.168.16.3 --netmask 255.255.255.0 --lowerip 192.168.16.137 --upperip 192.168.16.200 --enable VBoxManage modifyvm "$1" --nic3 natnetwork VBoxManage modifyvm "$1" --nat-network3 natnet1 VBoxManage dhcpserver add --netname intnet0 --ip 192.168.42.3 --netmask 255.255.255.0 --lowerip 192.168.42.100 --upperip 192.168.42.200 --enable VBoxManage modifyvm "$1" --nic2 intnet VBoxManage modifyvm "$1" --intnet2 intnet0 VBoxManage list natnets VBoxManage list hostonlyifs VBoxManage list dhcpservers |
Please note, as of today (2018-11-03) there appears to be an annoying issue with the DHCP server (5.2.20) for “NAT Network” (not just “NAT”). If you change the settings for the built-in DHCP … Continue reading
Posted in Computer / Server
Tagged linux, scripting, VBoxManage, VirtualBox, virtualization
Comments Off on A bit of VirtualBox scripting – NAT & DHCP