diff options
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/80_adminrun.inc')
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/80_adminrun.inc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/80_adminrun.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/80_adminrun.inc new file mode 100644 index 00000000..6e4a9e0a --- /dev/null +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/80_adminrun.inc @@ -0,0 +1,42 @@ +# vim:ft=sh + +spawn_process() +{ + if [ "$USERCREDS" -eq 1 ]; then + get_creds + USERNAME="$LOGINUSER" PASSWORD="$PW" runscript_visibility "$SCRIPT" "$USERPART" "$VISIBILITY" & + unset PASSWORD + unset PW + else + runscript_visibility "$SCRIPT" "$USERPART" "$VISIBILITY" & + fi + + local WAITPID="$!" + wait $WAITPID + local ERR=$? + logger "openslx utility: adminrun: script ${SCRIPT} (PID ${WAITPID}) finished, errorlevel ${ERR}." +} + +function adminrun() +{ + logger "openslx utility: adminrun: started." + + if [ ! -d "$ADMINRUNDIR" ]; then + logger "openslx utility: adminrun: no adminrun directory found." + return + fi + + logger "openslx utility: adminrun: adminrun directory found, starting scripts." + set_userpart + for SCRIPT in "$ADMINRUNDIR"/*; do + USERPART=" su -c - $LOCALUSER " # adminrun: not as user + # USERPART=" " + VISIBILITY=$(echo ${SCRIPT%%.*}|cut -f 2 -d "-") # visibility: 0 versteckt, 1 normal, 2 minimiert + USERCREDS=$(echo ${SCRIPT%%.*}|cut -f 3 -d "-") # user/pass: 0 nein, 1 ja + logger "openslx utility: adminrun: starting script ${SCRIPT} using visibility ${VISIBILITY} and usercreds ${USERCREDS}." + spawn_process & + done + + + +} |