mrbbq has asked for the wisdom of the Perl Monks concerning the following question:
ultimatly the $media_list var should just be a list of number:number:number etc. I pass it this through a file right now that I have to manually zero out each time I run the script. I want to create a file or blat the number out of the array directly to the command. Can someone give me a hint on how to do either? Thanks.$ejected_tapes=0 ; my @tapes_to_eject=@_ ; # Going to add the file checks and date stuff in perl – ongoing # We are going to have to generate a unique file # Todo: make better use of array itteration $stamp=`/bin/date +%Y%m%d%H%M%S`; `/bin/touch /u01/scripts/logs/$stamp.tapes`; $file="/u01/scripts/logs/$stamp.tapes"; # Now lets open a unique file and not worry about deleting each time open (MYFILE, '>>$file'); print MYFILE "$\@_[0]:$\@_[1]:$\@_[2]:$\@_[3]:$\@_[4]:$\@_[5]:$\@_[6]: +$\@_[7]:$\@_[8]:$\@_[9]:$\@_[10]:$\@_[11]:$\@_[12]:$\@_[13]:$\@_[14]" +; close (MYFILE); $media_list=`/bin/cat /u01/scripts/logs/$file`; If ( $ejected_tapes == $maxslots ) { print "The export door in robot $robot_num only holds $maxslot +s tape(s), \n"; print "and BLAM has now ejected that many tapes. Please go and + empty the\n"; print "import/export doors and press <RETURN> when you're fini +shed"; $ready=<STDIN>; $ejected_tapes=0; } `/usr/openv/volmgr/bin/vmchange -res -multi_eject -w -verbose +-rn $robot_num -rt tld -rh $robot_host -ml $media_list` ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help With Perl and Files
by toolic (Bishop) on Sep 27, 2007 at 20:40 UTC | |
|
Re: Help With Perl and Files
by perlfan (Parson) on Sep 27, 2007 at 20:54 UTC | |
by Anonymous Monk on Sep 28, 2007 at 22:41 UTC | |
|
Re: Help With Perl and Files
by johngg (Canon) on Sep 27, 2007 at 22:49 UTC | |
|
Re: Help With Perl and Files
by graff (Chancellor) on Sep 28, 2007 at 02:17 UTC |