Run custom command after VM start?

Discussion in 'Proxmox VE: Installation and configuration' started by SirMaster, Oct 11, 2018.

  1. SirMaster

    SirMaster New Member

    Joined:
    May 20, 2015
    Messages:
    23
    Likes Received:
    2
    I am looking for a way to run a custom shell command as root automatically sometime after a VM is started.

    I need the command to be run at least after the main KVM process and all it's threads have been created.

    The command I want to run is this:

    Code:
    ls /proc/$(pgrep -f nick-htpc)/task | xargs -n 1 chrt -f -p 1
    Anyone have any suggestions for how I can trigger this command to run after a VM has been started?

    It doesn't even have to be only after a specific VM is started since the command will only affect a specific VM's PIDs. However that would be a bonus if the way can be set to only run for a specific VM as that might come in handy in the future.

    Thanks
     
  2. MasterPhi

    MasterPhi New Member

    Joined:
    Jan 7, 2019
    Messages:
    3
    Likes Received:
    1
    Hi, have you figured out this problem ?
     
  3. SirMaster

    SirMaster New Member

    Joined:
    May 20, 2015
    Messages:
    23
    Likes Received:
    2
    Not really.

    What I did for now was to create a script inside the VM that runs when the VM starts up and that connects to Proxmox via SSH and runs my command.
     
  4. MasterPhi

    MasterPhi New Member

    Joined:
    Jan 7, 2019
    Messages:
    3
    Likes Received:
    1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice