Very Generic Linux Service Watchdog script Rumi, June 16, 2016 A strong watchdog script- indeed! #!/bin/bash # # watchdog # # Run as a cron job to keep an eye on what_to_monitor which should always # be running. Restart what_to_monitor and send notification as needed. # # This needs to be run as root or a user that can start system services. # # Revisions: 0.1 (20100506), 0.2 (20100507) NAME=what_to_monitor START=/full/path/to/$NAME NOTIFY=person1email NOTIFYCC=person2email GREP=/bin/grep PS=/bin/ps NOP=/bin/true DATE=/bin/date MAIL=/bin/mail RM=/bin/rm $PS -ef|$GREP -v grep|$GREP $NAME >/dev/null 2>&1 case "$?" in 0) # It is running in this case so we do nothing. $NOP ;; 1) echo "$NAME is NOT RUNNING. Starting $NAME and sending notices." $START 2>&1 >/dev/null & NOTICE=/tmp/watchdog.txt echo "$NAME was not running and was started on `$DATE`" > $NOTICE $MAIL -n -s "watchdog notice" -c $NOTIFYCC $NOTIFY < $NOTICE $RM -f $NOTICE ;; esac exit Src: http://blog.eracc.com/2010/05/08/linux-monitor-a-service-with-a-watchdog-script/ Related Scripts Watchdog
Bash Script To Restart Linux Server Services 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… Read More
frontaccounting- how to recover admin password October 18, 2010 If you manage to forget the admin password for a company in the system, how do you retrieve or reset it? You can reset the admin password for a company by using phpMyAdmin. Enter the company database and find the correct table prefix f.i. 0_users. Edit the user Admin. Paste… Read More
Daily Shell Backup Script April 19, 2013 #!/bin/sh DAY=`/bin/date +%Y%m%d` TFILE="/var/log/pdns-cache/$(basename $0).$DAY.csv" rec_control dump-cache $TFILE echo "cache dump completed, dump script by rumi (hasan.emdad@mango.com.bd)" Related Read More