0

I have a script that launches my website located in /home/webserver/run-website

#!/bin/bash

echo "launching website..."

service nginx start

cd /home/webserver/django_personal_website

screen -S website /home/webserver/uwsgi_run

and the uwsgi_run file looks like this

#!/bin/bash

uwsgi --socket blog.sock --module django_personal_website.wsgi --chmod-socket=666

when I try independently testing the first script with ./run-website, it works just fine.

I want Crontab to execute this script on reboot so I added the following line to sudo crontab -e

@reboot bash /home/webserver/run-website

I even tested just the command bash /home/webserver/run-website in the terminal and it works too but for some reason when I reboot my PC it doesn't launch the website.

Does anyone have any idea why that might be happening?

1 Answer 1

0

Screen requires a tty to start. Crontab jobs don't get a tty.

Running uwsgi inside screen is probably unnecessary.

If you can, instead of running this inside screen inside a cron job, it would be better to start it as a systemd service. At a glance, these instructions look like they might be helpful https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html

If setting this up as a systemd service is not an option, there are several other ways to allow a background job to save its output to a log file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .