
crimirish
New User
Feb 22, 2007, 11:13 AM
Post #1 of 4
(292 views)
|
|
Won't run Server command
|
Can't Post
|
|
Hi, In this script I am try to first print the name of a file passed through to the script, and then run a 'dos2unix' command on any files passed through. The script runs, prints to a log file, but does not run the actually 'dos2unix file file' command to the server. Any help would be appreciated my $basedir = "/iw-home/"; # base directory of Teamsite my $filename = $ARGV[0]; # name of .txt file created on the fly for every deployment my $mylogfile = "/app/data/teamsite-logs/admin_dos2unix.log"; #log of files command is run on my $deployflyfile = $basedir . "OpenDeployNG/tmp/" . $filename; open (MYINPUTFILE, "$deployflyfile") or die "Cannot Open file: $!"; open (MYLOGFILE, ">>$mylogfile") or die " Cannot Open file: $!"; my(@myarray) = <MYINPUTFILE>; # loops through array finding files deployed foreach $inputfile (@myarray) { $inputfile = $basedir . $inputfile; $filedate = `date +%Y%m%d%H%M`; $dos2unixcmd = "dos2unix $inputfile $inputfile"; # runs dos2unix command on all files deployed print MYLOGFILE "$filedate\n"; print MYLOGFILE "$dos2unixcmd\n"; # logs all files on which command was run `$dos2unixcmd`; } close MYINPUTFILE; close MYLOGFILE; exit (0);
|