TechFly has asked for the wisdom of the Perl Monks concerning the following question:
# ==================================================================== +== # # NAME: mksysb.pl # # AUTHOR: TechFly # Email: TechFlyG<a~t>Gmail # DATE : 7-13-2010 # # PURPOSE: Create an mksysb of servers listed in $path\mksysb.conf. # Also, purge all mksysb's that are over an age set by the # filemaxage parameter. # # ==================================================================== +== use strict; use warnings; my $confpath; my $servername; my $filepath; my $filemaxage; $confpath = "/export/mksysb"; $filepath = "/export/mksysb"; $filemaxage = "360"; open(FILE, '<', "$confpath/mksysbmachinelist.conf") or die $!; while(<FILE>){ chomp($servername = $_); if (-e "$filepath/$servername") { print("\n\n$servername\n"); }else{ print("\n\n$servername does not exist\n"); mkdir("$filepath/$servername"); } foreach(<$filepath/$servername/$servername*>){ print "$filemaxage"; if (-M $_ > "$filemaxage"){ print(" $_ will not be purged\n"); }else{ unlink($_) or print ("Cannot delete file $!");} } system("nim -o define -t mksysb -a server=master -a mk_image=yes -a lo +cation=$filepath/$servername/$servername\_`date +%m%d%Y` -a source=$s +ervername $servername\_`date +%m%d%Y`"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: check my code
by jwkrahn (Abbot) on Jul 14, 2010 at 03:11 UTC | |
|
Re: check my code
by toolic (Bishop) on Jul 14, 2010 at 03:12 UTC | |
by graff (Chancellor) on Jul 14, 2010 at 05:09 UTC | |
|
Re: check my code
by graff (Chancellor) on Jul 14, 2010 at 05:27 UTC | |
|
Re: check my code
by derby (Abbot) on Jul 14, 2010 at 10:32 UTC | |
|
Re: check my code
by TechFly (Scribe) on Jul 14, 2010 at 21:14 UTC |