From d422fe8b6491ab03d58e7283933f7328f38b3e9f Mon Sep 17 00:00:00 2001 From: nemunaire Date: Wed, 14 Jan 2015 12:36:31 +0100 Subject: [PATCH] Can precise a tempdir to gen_site.pl to use another directory instead of TMPDIR --- gen_site.pl | 16 ++++++++++++++-- launch_local.sh | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gen_site.pl b/gen_site.pl index bcfb3399..f037958b 100755 --- a/gen_site.pl +++ b/gen_site.pl @@ -32,7 +32,8 @@ our $outdir = "outest"; our $outteams = "/teams/"; our $outerrors = "/errors/"; our $outhome = "/htdocs/"; -our $tmpdir = tempdir(); +our $tmpdir_basename = File::Spec->tmpdir; +our $tmpdir; our $baseurl = "http://localhost"; our $baseadmin = "/admin/"; @@ -228,7 +229,7 @@ sub sync { say "Full synchronization to $main::outdir"; - my $tmpcopy = tempdir(); + my $tmpcopy = tempdir(DIR => $tmpdir_basename, CLEANUP => 1); find( sub @@ -386,11 +387,16 @@ GetOptions ("threads|thread|t=i" => \$threads, "baseerrors|be=s" => \$baseerrors, "baseteams|bt=s" => \$baseteams, "outdir|out|o=s" => \$outdir, + "tempdir|tmpdir|tmp|T=s" => \$tmpdir_basename, "deamon|d" => \$deamon, "socket|s=s" => \$socket, "help|h|?" => \$help); $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 if ($deamon) @@ -850,6 +856,12 @@ Path where save generated pages Path to the socket to create. +=item B<-tempdir=path> + +Path to use as basename for temporary directories. + +=back + =item B<-threads=int> Number of parallel fetch to perform. diff --git a/launch_local.sh b/launch_local.sh index 48f6202f..62f82fa3 100755 --- a/launch_local.sh +++ b/launch_local.sh @@ -22,7 +22,7 @@ KP1=$! 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=$! trap "kill $KP1 $KP2; rm -rf '$TMPF'; echo; kill $$" INT TERM