Bash Script To Restart Linux Server Services Rumi, December 21, 2021 Here’s the command line code to create the file in nano: sudo nano /opt/launch-crashed-services.sh Here is the bash script. #!/bin/bash service mysql status | grep ‘active (running)’ > /dev/null 2>&1 if [ $? != 0 ] then sudo service mysql restart > /dev/null fi service nginx status | grep ‘active… Continue Reading
Linux service restart shell script Rumi, November 29, 2013November 29, 2013 I badly needed a script that would check if my running services (in this script it'll check varnish and apache2 services) are alive- if not, it'll restart the dead service and write a log. Pretty handy! Continue Reading