#!/usr/local/bin/bash # # users-mrtg-crontab # # to be run out of a crontab like so: # */12 * * * * /usr/bin/nice -n 20 /root/mrtg/users-mrtg-crontab >/dev/null 2>&1 # # Zoidial Incorporated # Eric Thern -- eric(at)zoidial.com # # May 17, 2003 (updated) # # # run mrtg on all the users # for i in `ls -1 /root/mrtg/mrtg-users/ |grep cfg | awk -F"." '{print $1}'`; do /root/mrtg/mrtg /root/mrtg/mrtg-users/$i.cfg ; done # # check to see if users templates are the same as the admin templates # UTEMPLATE="`ls -1 /root/mrtg/mrtg-users | awk -F. '{print $1}' |uniq | wc -l`" ATEMPLATE="`ls -1 /root/mrtg/admin/user-templates/ | wc -l`" if [ "$UTEMPLATE" = "$ATEMPLATE" ] then # # they are the same, run an update on LOGS ONLY # /root/mrtg/admin/UPDATE-LOGS-ONLY else # # they are different, run a full admin update # /root/mrtg/admin/CREATE-ADMIN-PAGE fi