Can precise a tempdir to gen_site.pl to use another directory instead of TMPDIR

This commit is contained in:
nemunaire 2015-01-14 12:36:31 +01:00 committed by Nemunaire
parent 05cfe96d73
commit d422fe8b64
2 changed files with 15 additions and 3 deletions

View File

@ -32,7 +32,8 @@ our $outdir = "outest";
our $outteams = "/teams/"; our $outteams = "/teams/";
our $outerrors = "/errors/"; our $outerrors = "/errors/";
our $outhome = "/htdocs/"; our $outhome = "/htdocs/";
our $tmpdir = tempdir(); our $tmpdir_basename = File::Spec->tmpdir;
our $tmpdir;
our $baseurl = "http://localhost"; our $baseurl = "http://localhost";
our $baseadmin = "/admin/"; our $baseadmin = "/admin/";
@ -228,7 +229,7 @@ sub sync
{ {
say "Full synchronization to $main::outdir"; say "Full synchronization to $main::outdir";
my $tmpcopy = tempdir(); my $tmpcopy = tempdir(DIR => $tmpdir_basename, CLEANUP => 1);
find( find(
sub sub
@ -386,11 +387,16 @@ GetOptions ("threads|thread|t=i" => \$threads,
"baseerrors|be=s" => \$baseerrors, "baseerrors|be=s" => \$baseerrors,
"baseteams|bt=s" => \$baseteams, "baseteams|bt=s" => \$baseteams,
"outdir|out|o=s" => \$outdir, "outdir|out|o=s" => \$outdir,
"tempdir|tmpdir|tmp|T=s" => \$tmpdir_basename,
"deamon|d" => \$deamon, "deamon|d" => \$deamon,
"socket|s=s" => \$socket, "socket|s=s" => \$socket,
"help|h|?" => \$help); "help|h|?" => \$help);
$outdir = abs_path($outdir); $outdir = abs_path($outdir);
$tmpdir_basename = abs_path($tmpdir_basename);
# Create temporary directory
$tmpdir = tempdir(DIR => $tmpdir_basename);
# Daemon mode: run forever until stdin is open # Daemon mode: run forever until stdin is open
if ($deamon) if ($deamon)
@ -850,6 +856,12 @@ Path where save generated pages
Path to the socket to create. Path to the socket to create.
=item B<-tempdir=path>
Path to use as basename for temporary directories.
=back
=item B<-threads=int> =item B<-threads=int>
Number of parallel fetch to perform. Number of parallel fetch to perform.

View File

@ -22,7 +22,7 @@ KP1=$!
TMPF=`mktemp` TMPF=`mktemp`
tail -f "$TMPF" | ./gen_site.pl -d -s /tmp/scheduler.sock -bt /challenge/ -ba /challenge-admin/ -o ./out ERRORS HOME all DS & tail -f "$TMPF" | ./gen_site.pl -d -T /dev/shm -s /tmp/scheduler.sock -bt /challenge/ -ba /challenge-admin/ -o ./out ERRORS HOME all DS &
KP2=$! KP2=$!
trap "kill $KP1 $KP2; rm -rf '$TMPF'; echo; kill $$" INT TERM trap "kill $KP1 $KP2; rm -rf '$TMPF'; echo; kill $$" INT TERM