Script to restart bwmon_gargoyle if it goes down
Posted: Fri Feb 21, 2020 7:11 pm
This small script will check to see if a know request fails and tries to start up the service again. I assume that it is still enabled but crashed for whatever reason, which has happened to me in the past.
Crontab Entry every 10 min
Code: Select all
root@Gargoyle:~/scripts# cat mon_bwmon.sh
#!/bin/sh
if [[ "$(bw_get -i total5-upload-day-365 2>&1 | cut -c 0-125 )" == "ERROR: Bandwidth query failed, make sure rule with specified id exists, and that you are performing only one query at a time." ]]; then
/etc/init.d/bwmon_gargoyle start;
fi
Code: Select all
*/10 * * * * /root/scripts/mon_bwmon.sh