Please find my complete script below
#!/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 = <STDIN>; $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 to +p 20 culprits\n"); print ("###############################################"); $DU = `du -sh $FILESYSTEM | sort -rn | head -20`; print ("###############################################"); } else { ("The filesystem size looks good \n"); } }
In reply to Re^2: Getting error while executing the script
by arunkarthick
in thread Getting error while executing the script
by arunkarthick
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |