I need the infinite while loop for make sure Nmon is running.
I had found that sometime Nmon stopped itself with no reason and I have lost all stat for that hour.
#!/bin/bash
# hourly rotatation# nmon help
# -f spreadsheet output format [note: default -s300 -c288]
# -s <seconds> between refreshing the screen [default 2]
# -c <number> of refreshes [default millions]
# -t spreadsheet includes top processes
cd $(dirname 0)nmon -ft -s 1 -c 3600 -m $PWD
sleep 1while true
doif pgrep -u $(whoami) -f "nmon -ft -s 1 -c 3600 -m $PWD" &>/dev/null
then
echo "Nmon is running"
else
echo "Nmon is NOT running, restart Nmonx"
#nmon -ft -s 1 -c 3600 -m $PWD
fisleep 1done
That is all.