is there a way to run scripts on host start-up ?

Hell Angel

New Member
May 1, 2019
10
0
1
33
Hello everyone,
I want to run Scripts on host start-up, what should I do ?
this scripts:
Code:
echo 0 > /sys/class/vtconsole/vtcon0/bind
echo 0 > /sys/class/vtconsole/vtcon1/bind
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
I tried:

Code:
#!/bin/sh
nano /etc/init.d/superscript
chmod 755 /etc/init.d/superscript
update-rc.d superscript defaults
but not working automatically, still have to run service start-kvm start ;(
 
Last edited:
Wow, didn't realize it was the upgrade that did that. Was working on sr-iov passthrough for the ethernet 10g and thought I had ruined my config. Thanks again.
 
Sometimes I won't use my Proxmox home server for several days and I want to keep it off.
It has a wake up alarm set on BIOS to power on at 8 am every day. Then it makes a http request from a public server, checks whether the string "POWER=OFF" is present and if so, runs a "shutdown -P 1"
That command though won't work. I've already debugged this script, it's reaching the shutdown command, it's running as root, but somehow the server won't power off.
Any ideas what could be happening?
ps: I have also tried to detach the shutdown command with a & by the end of it.
ps2: If I run it over the command line (remote ssh), it will shutdown gracefully.
 
Hi,

I believe the answer to this specific need is VM hookscripts.

The example Perl script can be found at /usr/share/pve-docs/examples/guest-example-hookscript.pl
, but I believe bash or python can be used to write the needed hook.

The hook script accepts 2 arguments:

Bash:
hookscript "<VM_ID>" "<VM_PHASE>"

I did not test this but

- VM_ID is the integer VM ID.
- VM_PATH is one of pre-start, post-start, pre-stop, post-stop, and maybe others.
 
Last edited: