Simple Watchdog script

 I will give an example of a simple script for restarting services if they are not running and sending a notification by email:123456789101112131415161718#!/bin/bashSERVICES="ssh apache2 zabbix-server zabbix-agent mysql smbd nmbd asterisk"DATE=$(date '+%d-%m-%Y %H:%M:%S') for SERVICE in ${SERVICES} do   service $SERVICE status 2>&1>/dev/null    if...
Continue reading Simple Watchdog script

Restarting a Linux Server via Web Browser (PHP)

 After opening and reading every result on Google, I figured it's time to make my own thread somewhere.I'm trying to setup a means of rebooting/doing other system functions through a web interface powered by HTML (for the buttons/text) and PHP (for the execution of the aforementioned functions).I'm unable to get this to work. I've read that I need to add the web user to the sudoers file, and...
Continue reading Restarting a Linux Server via Web Browser (PHP)
,

Use a script to restart critical Linux services such as the web or database server. Restart nginx, apache2, MySQL or PHP-fpm automatically.

 If you manage your own WordPress web server then you have undoubtedly come across many situations where your web apache, nginx, MySQL or PHP-fpm services have stopped.Sometimes the reason is unknown and things just crash from time to time.Using the Linux crontab service we can write a simple bash script to test to see if these services have stopped and restart them.You can use whatever editor...
Continue reading Use a script to restart critical Linux services such as the web or database server. Restart nginx, apache2, MySQL or PHP-fpm automatically.