Last active
August 29, 2015 14:07
-
-
Save jrich523/dede9f8a3901d44c4c6c to your computer and use it in GitHub Desktop.
NBU error gathering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
currentTime=$(date) | |
timeStampFile="lastrun.txt" | |
#check to see if there is a timestamp file | |
if [ -f "$timeStampFile" ]; then | |
#read in last run date | |
lastRun=$(date -f "$timeStampFile") | |
#excute command and exit if it fails (dont store time) | |
/usr/openv/netbackup/bin/admincmd/bperror -d "$(date -d "$lastRun" '+%D %T')" -e "$(date -d "$currentTime -1 second" '+%D %T')" | |
#write current to last run | |
echo "$currentTime" > "$timeStampFile" | |
else | |
#excute command for all time and exit if it fails (dont store time) | |
/usr/openv/netbackup/bin/admincmd/bperror -e "$(date -d "$currentTime -1 second" '+%D %T')" | |
#write current to last run | |
echo "$currentTime" > "$timeStampFile" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment