Poetry command execution at startup (or as a service) #7282
-
|
I have a command I use to execute my python script on a vps:
This runs just fine on the command line, but I don't want to babysit it in a terminal and I do not want to manually run it in the background with & or nohup. I would like to simply have it run at bootup, ideally as a service (init.d or systemctl) but the virtual environment is throwing the whole thing off. This seems unnecessarily difficult -- how is poetry meant to be used in production? I cannot simply execute the script via python3 because the dependencies haven't been installed, which negates the need for poetry altogether. I feel like I'm missing something obvious, but I'm frustrated just trying to get my script to run, stay running, and requiring no manual oversight from me. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hey, this is not really a Poetry question. What you are asking for is, how to run a python script within a virtual environment through a systemd unit. The answers to this is: Use the full path to the python interpreter. See e.g. https://stackoverflow.com/questions/37211115/how-to-enable-a-virtualenv-in-a-systemd-service-unit |
Beta Was this translation helpful? Give feedback.
Hey,
this is not really a Poetry question. What you are asking for is, how to run a python script within a virtual environment through a systemd unit.
The answers to this is: Use the full path to the python interpreter. See e.g. https://stackoverflow.com/questions/37211115/how-to-enable-a-virtualenv-in-a-systemd-service-unit