How can I create a start up script for proxmox for when the system boots... e.g.: I would like to update "ethtool -K eno1 tso off gso off" to be written each time the system starts
crontab -e
) like this: @reboot /usr/sbin/ethtool -K eno1 tso off gso off > /dev/null 2>&1
.pre-up /usr/sbin/ethtool -K eno1 tso off gso off
below your eno1 interface ( iface eno1 inet ...) should run that command each time before bringing the eno1 NIC up.Thank you @Dunuin, I've opted for #3 as you've recommended; so far looks goodOption 1.) You can add a cron line (crontab -e
) like this:@reboot /usr/sbin/ethtool -K eno1 tso off gso off > /dev/null 2>&1
.
Option 2.) You create a oneshot systemd service like described here: https://trstringer.com/simple-vs-oneshot-systemd-service/
Option 3.) In case it is network related you also might want to use the "pre-up", "post-up" and so on constructs in your /etc/network/interfaces file. Adding a line likepre-up /usr/sbin/ethtool -K eno1 tso off gso off
below your eno1 interface ( iface eno1 inet ...) should run that command each time before bringing the eno1 NIC up.
So for your specific example I would prefer option 3. For simple stuff that just has to run once but its not important when, I would use option 1. Option 2 is the most powerful but also the most complex one that for example would allow you at which point in time in the boot sequence you want your command to be run.
I did option 3 to run "pre-up pvecm expected 1" but for some reason it does not work. Here is my file :Option 1.) You can add a cron line (crontab -e
) like this:@reboot /usr/sbin/ethtool -K eno1 tso off gso off > /dev/null 2>&1
.
Option 2.) You create a oneshot systemd service like described here: https://trstringer.com/simple-vs-oneshot-systemd-service/
Option 3.) In case it is network related you also might want to use the "pre-up", "post-up" and so on constructs in your /etc/network/interfaces file. Adding a line likepre-up /usr/sbin/ethtool -K eno1 tso off gso off
below your eno1 interface ( iface eno1 inet ...) should run that command each time before bringing the eno1 NIC up.
So for your specific example I would prefer option 3. For simple stuff that just has to run once but its not important when, I would use option 1. Option 2 is the most powerful but also the most complex one that for example would allow you at which point in time in the boot sequence you want your command to be run.
First question would be why you want to set "pvecm expected 1" at all?
Then I would try option 1:Please help me run this on every startup.
So:Option 1.) You can add a cron line (crontab -e
) like this:@reboot /usr/sbin/ethtool -K eno1 tso off gso off > /dev/null 2>&1
.
@reboot /usr/bin/pvecm expected 1 > /dev/null 2>&1
to your crontab.I run this command and just now power went off and on again and seems it did not work since I had to manually run the command again to run the VM...Then I would try option 1:
So:@reboot /usr/bin/pvecm expected 1 > /dev/null 2>&1
to your crontab.
Thats not a command you run, you write that line in your crontab file.I run this command and just now power went off and on again and seems it did not work since I had to manually run the command again to run the VM...
Ok so Here's a step by step guide:I run this command and just now power went off and on again and seems it did not work since I had to manually run the command again to run the VM...
@reboot /bin/sleep 300 ; /usr/bin/pvecm expected 1 > /dev/null 2>&1
We use essential cookies to make this site work, and optional cookies to enhance your experience.