Skip to content

Instantly share code, notes, and snippets.

@jrich523
Last active August 29, 2015 14:07
Show Gist options
  • Save jrich523/dede9f8a3901d44c4c6c to your computer and use it in GitHub Desktop.
Save jrich523/dede9f8a3901d44c4c6c to your computer and use it in GitHub Desktop.
NBU error gathering
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