diff options
author | Jonathan Bauer | 2017-02-15 12:35:52 +0100 |
---|---|---|
committer | Jonathan Bauer | 2017-02-15 12:35:52 +0100 |
commit | fc740d39fa8069c3a47b5f58e2ce16b67adbf7ed (patch) | |
tree | 51e2fd12526bfe571888aa531b0dd4c332c20766 /core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes | |
parent | [runvirt] introduced wrapper script to start ... (diff) | |
download | mltk-fc740d39fa8069c3a47b5f58e2ce16b67adbf7ed.tar.gz mltk-fc740d39fa8069c3a47b5f58e2ce16b67adbf7ed.tar.xz mltk-fc740d39fa8069c3a47b5f58e2ce16b67adbf7ed.zip |
[runvirt] reworked wrapper log handling
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes')
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc index e551e5e8..b49488cb 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc @@ -9,12 +9,20 @@ declare -rg TMPDIR="/tmp/virt/${USER}/$$" # Check if the path to the logfile was given externally (by the wrapper) unset WRAPPED -if isset LOGFILE; then - # given by wrapper - declare -rg WRAPPED=aye -else - declare -rg LOGFILE="/var/log/openslx/run-virt.${USER}.$$.log" +if notempty LOGFILE; then + if [ ! -w "${LOGFILE}" ]; then + # given logfile is not writeable or non-existant + # so handle it ourself (so do not set WRAPPED) + rm -f "${LOGFILE}" + unset LOGFILE + else + # given logfile was ok, mark that we are wrapped + # (for cleanexit to not slxlog the log since + # the wrapper is handling that for us) + declare -rg WRAPPED=aye + fi fi +isset LOGFILE || declare -rg LOGFILE="/var/log/openslx/run-virt.${USER}.$$.log" # Create temporary directory for current invocation if check_dep mkdir && ! mkdir -p "$TMPDIR"; then |