I'm trying to detect an error and restart server from django application. I'm using the following code:
try:
# do something
except:
print('here')
subprocess.call(['/home/my_username/restart.sh'])
restart.sh is as follows
#!/bin/sh
/home/my_username/webapps/app/apache2/bin/restart
/home/my_username/webapps/my_db/bin/cron
I'm using webfaction as hosting provider. Aboved code prints statement, but doesn't restart the server and doesn't start mysql database which is under my_db.
Maybe I need to supply username/pass? How to do that?