ramses0 has asked for the wisdom of the Perl Monks concerning the following question:
Scenario is:
/var/log/newlogs/One_Log_Dir/log.txt, screenshots.jpg, etc.
So... put up a web-page with checkboxes and the output of:
(remember, this is glue-code, so I'm not using / learning readdir / opendir, etc yet).@files = `find /var/log/newlogs -name log.txt -maxdepth 2`
...and after a submission (where $cgi->param('logs') is filled with checkboxed selected items...)
for my $log ( @logs ) { add_and_trash( $log ) }
Where add_and_trash() is something like:
sub add_and_trash { my ($name) = @_; my $newname = `convert $name`; print "<hr>\n"; my $cmd1 = "/tools/addbundle.pl $newname"; print $cmd1. "<hr>\n"; system( $cmd1 ); # can take ~2-3 minutes my $cmd2 = "mv $newname /tmp/trashed"; print $cmd2. "<hr>\n"; system( $cmd2 ); }
Can anyone see any problems? Every single function call is being called correctly. If I take the copy/paste of the print $cmd's and paste them manually into a bash session, everything works, it's only when run from the perl front-end that it bombs.
`whoami` reports back 'rames', not 'nobody'. Any ideas / assistance would be welcome. Sorry for chopping apart the script (it's long and boring, otherwise), hopefully my perl-fu is strong enough that I didn't make any syntax errors while paring it down.
I've done reading with perldoc perlops (for ``), and perldoc -f system, but just can't figure out why when *I* copy and paste the commands by hand it works, but perl (perl/cgi running through apache) can't get it working.
Assistance is appreciated, I'll respond with more details if there are parts that I'm missing.
--Robert
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: system( 'mv ...' ) not working?
by snax (Hermit) on Sep 23, 2003 at 16:05 UTC | |
|
Re: system( 'mv ...' ) not working?
by bm (Hermit) on Sep 23, 2003 at 16:05 UTC | |
|
Re: system( 'mv ...' ) not working?
by helgi (Hermit) on Sep 23, 2003 at 16:20 UTC | |
by Grygonos (Chaplain) on Sep 23, 2003 at 16:55 UTC | |
by ramses0 (Initiate) on Sep 23, 2003 at 18:40 UTC | |
|
Re: system( 'mv ...' ) not working?
by Abigail-II (Bishop) on Sep 23, 2003 at 16:12 UTC | |
|
Re: system( 'mv ...' ) not working?
by Roger (Parson) on Sep 24, 2003 at 02:56 UTC |