I have installed an azure agent on a self hosted linux VM as per the documentation here & like to start the agent (i.e., trigger ./run.sh) when the VM is started everytime.
You can set the agent as a systemed service.
If your agent is running on these operating systems you can run the agent as a systemd service:
Ubuntu 16 LTS or newer
Red Hat 7.1 or newer