summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2018-10-15 10:26:49 +0200
committerKarel Kočí <karel.koci@nic.cz>2018-10-15 10:26:49 +0200
commite112f6e0e849fcc0849bff78d7791a1e56c62f7c (patch)
tree3dff2008c6edfb174bdee10622d9ea792c8b2a19
parentd7d5ba1e6aa10a6cae3ba956a00caecdc1452cbc (diff)
downloadlaminar-cnf-e112f6e0e849fcc0849bff78d7791a1e56c62f7c.tar.gz
laminar-cnf-e112f6e0e849fcc0849bff78d7791a1e56c62f7c.tar.bz2
laminar-cnf-e112f6e0e849fcc0849bff78d7791a1e56c62f7c.zip
Improve job.common
-rw-r--r--job.common17
1 files changed, 13 insertions, 4 deletions
diff --git a/job.common b/job.common
index 165f61c..a27ce12 100644
--- a/job.common
+++ b/job.common
@@ -1,5 +1,11 @@
# vim: ft=sh
set -e
+# Ensure niceness at least 10
+if [ "$(nice)" -lt 10 ]; then
+ exec nice "$0" "$@"
+fi
+
+# Use fake laminar in case of external execution
if [ -z "$WORKSPACE" ]; then
. "$(dirname "$(readlink -f "$0")")/../fakelaminar"
fi
@@ -9,17 +15,20 @@ if [ -z "$LAMINAR_COMMON" ]; then
export LAMINAR_COMMON=y
# Job and template id
- export JOBID="$(basename "$0" | sed 's/\.run$//')"
- export TEMPLATEID="$(basename "$(readlink -f "$0")" | sed 's/\.run$//')"
+ JOBID="$(basename "$0" | sed 's/\.run$//')"
+ TEMPLATEID="$(basename "$(readlink -f "$0")" | sed 's/\.run$//')"
+ export JOBID TEMPLATEID
# Template workspace
- export TWORKSPACE="$HOME/workspace/$TEMPLATEID"
+ TWORKSPACE="$HOME/workspace/$TEMPLATEID"
if [ "$JOBID" = "$TEMPLATEID" ]; then
TWORKSPACE="$HOME/workspace/notemplate"
fi
+ export TWORKSPACE
# Files directory
- export FILES="$(readlink -f "$(dirname "$(readlink -f "$0")")/../files")"
+ FILES="$(readlink -f "$(dirname "$(readlink -f "$0")")/../files")"
+ export FILES
fi