#!/usr/local/bin/perl #Program to find the disk space and to delete the older files #Checks the type of OS here $OS = `uname -s`; print ("The Operating System is $OS"); if ($OS == SunOS ) { print ("Enter the filesystem related to SUN \n"); $FILESYSTEM = ; $DF = `df -h $FILESYSTEM | grep -v "Filesystem" | sed -e "s/%//g"|awk '{print $5}'`; print ("The file system $ FILESYSTEM usage is $DF % \n"); while ($DF > 50){ print ("The file system $FILESYSTEM reached its maximum capacity $DF % and request you to clear the space /n"); print (" Checking the disk usage of $FILESYSTEM and finding the top 20 culprits\n"); print ("###############################################"); $DU = `du -sh $FILESYSTEM | sort -rn | head -20`; print ("###############################################"); } else { ("The filesystem size looks good \n"); } }