Creating a simple bash script menu on reboot

Dec 20, 2019
7
0
1
UK
Hey guys.

Apologies in advance for a naive question amidst these deep technical discussions.

I run a simple setup. Home lab, virtualised hackintosh, windows 10 PC, ubuntu, that I run generally one VM at a time with GPU PCI passthrough.
I generally boot the machine and use my ipad to select the guest VM through the web console... which is fine, but a bit of a pain.

I've written a simple bash script that asks me which guest VM I want to run (option 1-3 with a default after a few seconds ) and then turns the monitor off for the host proxmox console and fires up the VM I want. The passthrough GPU grabs the monitor with the PCI passthrough - using a different input (DP vs. HDMI) to the integrated graphics card that proxmox fires up with... and away I go.

vbetool dpms off
qm start 104
etc.

It works great if I manually execute it from the command line, but I want it to run automatically on reboot.

I tried setting up the script as a cron job at @reboot, but I'm just thrown straight to the console login for proxmox.
Can someone point me to what I need to hook into so that when proxmox reboots my script gets triggered, echoing to screen and asking for input.

I'd be grateful for any pointers. I'm sure that some other home Proxmox users would appreciate being able to set up something similar in the future.

Thanks
 

oguz

Proxmox Retired Staff
Retired Staff
Nov 19, 2018
5,207
694
118
hi,

you can call it in your ~/.bashrc file or something similar, so it starts when you're logged in.

to prevent it from running multiple times, you can add a check in the beginning based on the uptime command.
 
  • Like
Reactions: Jayboyb

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!