diff --git a/crab/scram-build/run.sh b/crab/scram-build/run.sh
index 63319444465..62c974f9a4b 100755
--- a/crab/scram-build/run.sh
+++ b/crab/scram-build/run.sh
@@ -1,5 +1,5 @@
#!/bin/bash -x
-log="run.log"
+log="$CMSSW_BASE/run.log"
ld.so --help | grep supported | grep x86-64-v
pushd $CMSSW_BASE
sed -i -e 's|| \n \n|' config/toolbox/${SCRAM_ARCH}/tools/selected/cuda.xml
@@ -32,4 +32,4 @@ pushd $CMSSW_BASE
find lib -type f >>$log
done
popd
-mv $CMSSW_BASE/$log .
+[ -f run.log ] || mv $log .
diff --git a/crab/scram-build/task.py b/crab/scram-build/task.py
index adc831b6079..b0f4526c9ad 100644
--- a/crab/scram-build/task.py
+++ b/crab/scram-build/task.py
@@ -17,7 +17,7 @@
config.JobType.psetName = "pset.py"
config.JobType.pluginName = "PrivateMC"
-config.JobType.maxJobRuntimeMin = 120
+config.JobType.maxJobRuntimeMin = int(os.getenv("CRAB_MAX_TIME", "480"))
config.JobType.maxMemoryMB = 8000
config.JobType.numCores = 4
config.JobType.allowUndistributedCMSSW = True