|
|
@@ -534,8 +534,20 @@ for cmd in $cmds; do
|
|
|
# execute the generated script with GNU Bash
|
|
|
if [ ".$user" != ".$s_user" ]; then
|
|
|
# execute as different user
|
|
|
- su - $s_user -c "PATH=\"$PATH\"; $bash $tmpfile" >$outfile 2>$errfile
|
|
|
- rc=$?
|
|
|
+ if [ ".$user" = ".@l_susr@" -a ".@l_susr@" = ".root" ]; then
|
|
|
+ su - $s_user -c "PATH=\"$PATH\"; $bash $tmpfile" >$outfile 2>$errfile
|
|
|
+ rc=$?
|
|
|
+ elif [ ".@l_susr@" != ".root" ]; then
|
|
|
+ # do not complain if we would not have any chance
|
|
|
+ # at all to switch the user because we are running
|
|
|
+ # in a non-privileged instance. Else we would just
|
|
|
+ # trash the mailbox of the user receiving the
|
|
|
+ # output of periodic run-commands.
|
|
|
+ rc=0
|
|
|
+ else
|
|
|
+ echo "openpkg:rc:WARNING: $prefix:$s_name:%$cmd: require root privileges to run as user \"$s_user\"" 1>&2
|
|
|
+ rc=1
|
|
|
+ fi
|
|
|
else
|
|
|
# execute as current user
|
|
|
$bash $tmpfile >$outfile 2>$errfile
|