https://prefect.io logo
#prefect-community
Title
# prefect-community
y

YD

10/28/2022, 11:31 PM
Hi When using prefect 2, I assume we still need the agent to run in the background all the time. do we still need to run something like
nohup prefect agent start -q …  > ~/tmp/prefect_agent.log &
or is there a different way to keep the agent running? is there best practice around this in the docs? I did not find it so far Thanks
1
r

Ryan Peden

10/28/2022, 11:33 PM
A systemd service is often a good choice for this. I did a short writeup on how to set it up: https://discourse.prefect.io/t/how-to-run-a-prefect-2-agent-as-a-systemd-service-on-linux/1450
🙌 1
🙏 1
I find systemd a bit easier to work with, but both are good options depending on your needs/preferences.
m

merlin

10/29/2022, 5:35 PM
This is great, thanks for sharing! Its handy to have a local testing environment with just a little bit of configuration like this. For an actual service deployed to ECS or K8s, I assume the agent start and etc. would be part of the preconfigured launch which will run again if a pod dies for example.
r

Rabea Yousof

11/14/2022, 1:34 PM
Thanks @Ryan Peden, can i apply the systemd service on multiple virtual environment with one service?