First of all. I don't know anything about bash scripting. second this is a very big problem on my side, and I don't have any idea what to do.
Currently, I have this website. which was written in php. and uses mail server and push notification which are all runned as daemon using supervisord. My site is running well but from time to time, my mail server and push notification doens't work because the supervisord stopped working; I had to restart it manually to make it working again.
I was thinking, what could I do to have it auto start. then an idea popped up. to restart the service via bash script and cron jobs. I know it was kinda dumb.
I created a bash script . just a simple one.
#!/bin/bash # A simple script echo " -- Restarting Supervisord --" sudo service supervisor stop sudo service supervisor start echo "Done!"
when I run this manually via
this was the output I've got
-- Restarting Supervisord -- Job for supervisor.service failed. See "systemctl status supervisor.service" and "journalctl -xe" for details. Done!
allso I don't konw if this is right in cronjob
0 0,12 * * * /supervisord_restart.sh
by the way if I am doing right. I need my bash script to check if suprevisord is running then execute the commands.