Update the script and add the logic to detect and warn the u
Update the script and add the logic to detect and warn the user if the disk usage is above 80%
#! /bin/bash
LOGFILE=\"diskusage.log\"
if [[ -n $1 ]]
 then
    $LOGFILE=$1
 fi
if [ ! -e $LOGFILE ]
then
   printf \"%-10s %-14s %-10s %-6s %-6s %-6s %-6s\  \" \"Date\" \"IP Address\" \"Device\" \"Capacity\" \"Used\" \"Free\" \"Percentage\" > $LOGFILE
 fi
IP_LIST=\"10.10.10.2\"
 (
 for ip in $IP_LIST;
 do
    ssh client@$ip \'df -H\' | grep ^/dev/ > /tmp/$$.df
    while read line;   
    do
    cur_date=$(date +%D)
    printf \"%-10s %-14s\" $cur_date $ip
    echo $line | awk \'{ printf( \"%-10s %-6s %-6s %-6s %-6s\ \", $1,$2,$3,$4,$5);}\'
    done < /tmp/$$.df
 done
 ) >> $LOGFILE
Solution
*******************************************Script************************************************
#! /bin/bash
 dt=`date +%D`
df -h > /tmp/$$.df
   
 LOGFILE=\"diskusage.log\"
 if [[ -n $1 ]]
 then
 $LOGFILE=$1
 fi
 if [ ! -e $LOGFILE ]
 then
 printf \"%-10s %-14s %-10s %-6s %-6s %-6s %-6s\  \" \"Date\" \"IP Address\" \"Device\" \"Capacity\" \"Used\" \"Free\" \"Percentage\" > $LOGFILE
 fi
 IP_LIST=\"10.10.10.2\"
 (
 for ip in $IP_LIST;
 do
 ssh client@$ip \'df -H\' | grep ^/dev/ > /tmp/$$.df
 while read line;   
 do
 //cur_date=$(date +%D)
 printf \"%-10s %-14s\" $dt $ip
//code which is responsible to detect disk uses 80%+
echo -n \"$dt $line \";;
 echo -n \"$dt \"
 echo $line | awk \'{print $4}\';;
 echo -n \"$dt \"
 echo $line | awk \'{print $1,$5}\';;
 done < /tmp/$$.df
 done
 ) >> $LOGFILE


