November 30, 2015

Monitoring offline backup when not having permissions

It normally happens, mostly in unix that you request the backup team to execute one of theirs offline, and that they start the execution and you are waiting just for the minute it gets completed to continue.

In my case I didn't have access to anything to check its status but to the ps command at os level, and taking this into account a simple solution was as follows:


while true; do PROCESSES=`ps -ef | grep save | grep -v grep | wc -l`; if [ $PROCESSES -ne 0 ]; then echo "Running backup processes: $PROCESSES"; sleep 1; else echo "---------------------------------------------------"; echo "---------------------------------------------------"; echo "---------------------------------------------------"; echo "---------------------------------------------------"; echo "---------------------------------------------------"; echo '----------------BACKUP COMPLETED!!!----------------'; echo "---------------------------------------------------"; echo "---------------------------------------------------"; echo "---------------------------------------------------"; echo "---------------------------------------------------"; echo "---------------------------------------------------"; break; fi; done