Answer the question
In order to leave comments, you need to log in
How can a virtual environment be deployed as a service?
There is a code written in python34, it is launched through a virtual environment. I deployed it to the server, I connect via putty, but it’s not an option to start the virtual environment every time, I want to run this virtual machine once as a service. I rummaged through the Internet, there is an option to run it as a demon, but I didn’t really understand who faced such a problem, if there are other options or tips, thank you in advance.
Answer the question
In order to leave comments, you need to log in
I made such a sh to launch the telegram bot. set cron to run this file every 30 minutes. Yes, the option is not very good, but there is a place to be. the script finds the process, if it is running, kills it (so as not to produce processes) and starts it again.
#!/bin/bash
kill $(ps aux | grep 'bot.py' | awk '{print $2}')
python /var/TelBot/bot.py
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question