Feedback on a script
Hi there --
I am writing a script, based on one from an older UNIX reference guide, that is meant to check the size of a series of folders, and if any exceed a defined size, the administrator will be notified via e-mail. The syntax of the script is currently the following: Code:
#!/bin/bash 1. The limit= line sets the amount 80000 blocks. What would the syntax be to set the amount to 400 gigabytes. 2. Should the clinics= line read as-is, or should the syntax be the following: Code:
clinics='ls -lh /CMS/xiodata' |
Sorry, should not have replied so quick [EDIT]
Perhaps a perl script would be better suited for your task? ie: #!/usr/bin/perl open( PIPE, "du -hcs /CMS/$clinics|" ) or die "Couldn't read pipe: $!"; while ( <PIPE> ) { my( $f1, $f2 ) = split ' ', $_; if($f1 =~ /G/) { # do something with gigs } if($f2 =~ /M/) { # do something with megabytes } } close(PIPE); |
All times are GMT -5. The time now is 11:31 AM. |