I get a daily report about backups for each of the projects. One particular one has shown some odd results. The report has columns for: Completed, Successful, Partial, Failed, Missed, and Active. The particular problem is that backups show up in none of those columns when it is actually still actively running. (So it should show up as active?)
So I wrote the other day a Bash script to check some things. In the future I can quickly assess if this is the SNAFU (Situation Normal All F***ed Up) or something else. Really, the other day I had to track back into my history this information to do it manually, which is stupid.
#!/bin/bash
###########################################################
# Check backup status.
# 2015-JUL-24 Ezra Freelove, email@domain.com
###########################################################
# Look for running processes
echo “… Backup processes”
ps -ef | grep [p]rocname
# Report logs
echo “… Logs”
ls -ltr /path/to/agent.log /session/path/to/clientlogs/*.log
echo “==========”
# Specific lines excluding spam and blank
tail -100 /path/to/agent.log | grep -vf /home/me/myscripts/backups/exclude/ckrunning.txt | grep -v “^ $”
If the backup is still running, then the ps will show the PID and time started.
In addition the logs are reported with the most recently changed at the end.
The agent talks to a central service to find out when it should be doing stuff. The exclude/ckrunning.txt file uses the below entries to ignore spammy lines where the agent is checking but not told to do anything. This ignores about 70 of the 100 lines when everything is normally operating from my check.
- Sleeping
- Workorder received: sleep
- Requesting work
Long-term, I guess I should ask why the long-running backup does not appear in the Active category when it obviously should.
Leave a Reply