blob: 6e4a9e0a4e3a8cb84431ed50e98f9180473d6090 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
}
|