Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

Bash commands execution logging for debugging

touch /tmp/diskusage
df -h | tee -a /tmp/diskusage

UStatus=`echo "$?"`

if [ $UStatus -eq 0 ]; then
        sudo logger "Successfully Execuated" -t DiskUsagePass -f /var/log/messages &>/dev/null
else
        sudo logger "Failed To Execuate df command" -t DiskUsageFailed -f /var/log/messages &>/dev/null
fi
 
PREVIOUS NEXT
Tagged: #Bash #commands #execution #logging #debugging
ADD COMMENT
Topic
Name
1+1 =