I have deployed Django application with gunicorn + nginx + postgres. I am using digitalocean ubuntu server.Which sometimes once in a month reboots automatically so that application goes down. How to auto restart the application? my start-up script:
#!/bin/bash
#activate virtual env
echo Activate vitualenv.
source /home/wrangler_env/bin/activate
#restart database
#echo restarting database
#sudo service postgresql restart
# Start Gunicorn processes
echo Starting Gunicorn.
gunicorn wrangler.wsgi:application --bind=0.0.0.0:1312 --daemon
#restart nginx
echo Restarting Nginx
service nginx restart
This script I re-run manually once the server reboot automatically.