Answer the question
In order to leave comments, you need to log in
How to autorun python script in linux?
sh - script:
#!/bin/bash
cd /home/dev/myapp/ \
&& source venv/bin/activate \
&& gunicorn -c gunicorn_config.py run_app:app
[Unit]
Description=My Script Service
After=default.target
[Service]
Type=simple
ExecStart=/root/runserver.sh
Restart=always
User=root
[Install]
WantedBy=multi-user.target
Answer the question
In order to leave comments, you need to log in
1. It's okay for you to read the documentation for the tools you use
- docs.gunicorn.org/en/stable/deploy.html
2. It's okay for you to enter a request in Google to search for deployment methods for the tools you use
- https://bartsimons.me/gunicorn- as-a-systemd-service/
3. It's up to you to study the operating system and its tools
- https://habr.com/ru/company/southbridge/blog/255845/
4. Throw out your script, systemd supervisor and it is not involved by launching scripts, and if you really want to, then don't forget about "environment variables".
But on the other hand, it’s not vlom to come and write a lot of letters on the toaster and at the same time they didn’t even bother to indicate the operating system, specific and not general Linux of which there are 100500 distros and many have their own jokes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question