Perhaps I'm using the incorrect vocabulary, but I can't seem to find a duplicate of my issue. I am trying to execute two programs within my shell script and cron is clearly executing the first script, but not the second.
I have two python scripts,
views.py that runs as a web server and
housekeeping.py that takes care of some cleanup and update checks that the web interface need not worry about. Currently, these can be manually started using
sudo /home/ubuntu/start_server.sh and all works perfectly. I am using port 80, so I need to run as root.
The full bash script:
#!/bin/bash /home/ubuntu/py3env/bin/python /home/ubuntu/flask_portal/views.py & /home/ubuntu/py3env/bin/python /home/ubuntu/flask_portal/housekeeping.py &
My understanding is that the
& will cause applications to run in the background.
When I execute manually, the shell script works perfectly.
To open crontab, I am using
sudo crontab -u root -e
As I said above, I am using port 80 so I need to run my script as root.
Within the crontab file, I have a single entry:
When I execute by hand, both scripts start perfectly. When I allow the server to restart and run the
start_server.sh script itself, the web server
views.py works just fine, but
housekeeping.py never starts (I'm doing logging within that file, so it isn't generating the proper files). In addition, when I execute
python aux | grep python, I see that both
housekeeping.py are executing.