The second line below is causing me some problems (the first line just echos the command with the variables expanded): print "cp -a $dirbase/$sitedir/$_ $backupdir/$_\n" if $debug; system "cp -a $dirbase/$sitedir/$_ $backupdir/$_\n" or die "Can't copy to $backupdir/$_: $!";
When I run my program, I get this output: cp -a /var/www/coreinitiative/htdocs/index.html /var/www/disclaimer-backup-200304091637/coreinitiative/htdocs/index.html Can't copy to /var/www/disclaimer-backup-200304091637/coreinitiative/htdocs/index.html: Illegal seek at ./exit_disclaimer.pl line 112.
I even changed the second line to: system "echo -a $dirbase/$sitedir/$_ $backupdir/$_\n" or die "Can't copy to $backupdir/$_: $!";
which doesn't try to do much of anything at all. Then, running the program gives me: -a /var/www/coreinitiative/htdocs/index.html /var/www/disclaimer-backup-200304091643/coreinitiative/htdocs/index.html Can't copy to /var/www/disclaimer-backup-200304091643/coreinitiative/htdocs/index.html: Illegal seek at ./exit_disclaimer.pl line 112.
The first line is the 'echo', the second is the 'die' clause working.
I've tried using exec or backticks, with about the same result. Googling on "Illegal seek" produced some notes about timing and pipes, but adding a 'sleep 1' after the cp didn't help either.
Any guesses what's going wrong, and how to fix it?
Thanks for your thoughts and suggestions.
-Kevin Zembower
----- E. Kevin Zembower Unix Administrator Johns Hopkins University/Center for Communications Programs 111 Market Place, Suite 310 Baltimore, MD 21202 410-659-6139
The second line below is causing me some problems (the first line just >echos the command with the variables expanded):> print "cp -a $dirbase/$sitedir/$_ $backupdir/$_\n" if $debug;> system "cp -a $dirbase/$sitedir/$_ $backupdir/$_\n" or die "Can't copy >to $backupdir/$_: $!";>
When I run my program, I get this output:>cp -a /var/www/coreinitiative/htdocs/index.html >/var/www/disclaimer-backup-200304091637/coreinitiative/htdocs/index.html>Can't copy to >/var/www/disclaimer-backup-200304091637/coreinitiative/htdocs/index.html: >Illegal seek at ./exit_disclaimer.pl line 112.>
I even changed the second line to:>system "echo -a $dirbase/$sitedir/$_ $backupdir/$_\n" or die "Can't copy >to $backupdir/$_: $!";>
which doesn't try to do much of anything at all. Then, running the program >gives me:>-a /var/www/coreinitiative/htdocs/index.html >/var/www/disclaimer-backup-200304091643/coreinitiative/htdocs/index.html>Can't copy to >/var/www/disclaimer-backup-200304091643/coreinitiative/htdocs/index.html: >Illegal seek at ./exit_disclaimer.pl line 112.>
The first line is the 'echo', the second is the 'die' clause working.>
I've tried using exec or backticks, with about the same result. Googling on >"Illegal seek" produced some notes about timing and pipes, but adding a >'sleep 1' after the cp didn't help either.>
Any guesses what's going wrong, and how to fix it?>
Thanks for your thoughts and suggestions.>
-Kevin Zembower>
----->E. Kevin Zembower>Unix Administrator>Johns Hopkins University/Center for Communications Programs>111 Market Place, Suite 310>Baltimore, MD 21202>410-659-6139>
Kevin Zembower 11 April 2003 23:30:09 [ permanent link ]
Thank you so much. I'll try to implement what you said on Monday, when I'm not so brain-dead. I suspected it might have to do with the exit status of the cp command, but I couldn't find in all my references what codes cp and other system commands use. So, "Illegal seek" was a complete red herring, huh?
Thanks, again.
-Kevin
Perl Median <perlmedian@hotmail.com> 04/09/03 04:58PM >>>
you're using system the wrong way... system returns the exit status of the command... most commands exit 0 on success so you will always die.
you need to change the way you die:
option 1: change that "or die" to "and die" but that might confuse others
option 2: check $? (also the exit status of the last command) if it is none zero, then die.
The second line below is causing me some problems (the first line just >echos the command with the variables expanded):> print "cp -a $dirbase/$sitedir/$_ $backupdir/$_\n" if $debug;> system "cp -a $dirbase/$sitedir/$_ $backupdir/$_\n" or die "Can't copy >to $backupdir/$_: $!";>
When I run my program, I get this output:>cp -a /var/www/coreinitiative/htdocs/index.html >/var/www/disclaimer-backup-200304091637/coreinitiative/htdocs/index.html>Can't copy to >/var/www/disclaimer-backup-200304091637/coreinitiative/htdocs/index.html: >Illegal seek at ./exit_disclaimer.pl line 112.>
I even changed the second line to:>system "echo -a $dirbase/$sitedir/$_ $backupdir/$_\n" or die "Can't copy >to $backupdir/$_: $!";>
which doesn't try to do much of anything at all. Then, running the program >gives me:>-a /var/www/coreinitiative/htdocs/index.html >/var/www/disclaimer-backup-200304091643/coreinitiative/htdocs/index.html>Can't copy to >/var/www/disclaimer-backup-200304091643/coreinitiative/htdocs/index.html: >Illegal seek at ./exit_disclaimer.pl line 112.>
The first line is the 'echo', the second is the 'die' clause working.>
I've tried using exec or backticks, with about the same result. Googling on >"Illegal seek" produced some notes about timing and pipes, but adding a >'sleep 1' after the cp didn't help either.>
Any guesses what's going wrong, and how to fix it?>
Thanks for your thoughts and suggestions.>
-Kevin Zembower>
----->E. Kevin Zembower>Unix Administrator>Johns Hopkins University/Center for Communications Programs>111 Market Place, Suite 310>Baltimore, MD 21202>410-659-6139>
Kevin Zembower wrote:> Thank you so much. I'll try to implement what you said on Monday, when I'm not so brain-dead.> I suspected it might have to do with the exit status of the cp command, but I couldn't find> in all my references what codes cp and other system commands use. So, "Illegal seek" was a> complete red herring, huh?
The system() command won't set $! for you - its value should be regarded as undefined. In this case it happens to have the value 29 - 'Invalid seek'. The exit status of your 'cp' command will be in $?. Take a look at
If you would like to report an abuse of our service, such as a spam message, please . Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .