OPTS_VCONTEXT_CREATE=( $SILENT_OPT \
${ctx:+--xid "$ctx"} )
## put '--secure' at front so that it can be overridden
- OPTS_VATTRIBUTE=( --secure "${OPTS_VATTRIBUTE[@]}" )
+ OPTS_VATTRIBUTE=( --secure --flag default "${OPTS_VATTRIBUTE[@]}" )
}
function _generateScheduleOptions
if $_VSERVER_INFO - FEATURE vwait; then
local _is_tmpdir
_is_tmpdir=$($_MKTEMPDIR /tmp/vwaitstat.XXXXXX)
-
- $_NOHUP $_VWAIT --timeout "$VSHELPER_SYNC_TIMEOUT" \
- --terminate --status-fd 3 "$2" \
- >>$_is_tmpdir/out 2>$_is_tmpdir/err 3>$_is_tmpdir/fifo &
+ (
+ $_VWAIT --timeout "$VSHELPER_SYNC_TIMEOUT" \
+ --status-fd 3 "$2" \
+ >>$_is_tmpdir/out 2>$_is_tmpdir/err 3>$_is_tmpdir/fifo
+ rc=$?
+
+ if test "$rc" -ne 0 -a "$rc" -ne 1; then
+ $_VPS axf | $_EGREP -e "^[^ \t]+[ \t]+$S_CONTEXT[ \t]+" >&4
+ killContext "$S_CONTEXT" 9
+ fi
+
+ exit $rc
+ ) 4>$_is_tmpdir/procs &
+
echo "$!" >$_is_tmpdir/pid
eval "$3"=$_is_tmpdir
- fi
+ fi </dev/null
}
-## Usage: _waitForVWait <fifo> <pid>
+## Usage: _waitForVWait <vserver> <fifo> <pid> <procs>
function _waitForVWait
{
+ wait "$3" || :
+
declare -a status
- wait "$2" || :
- getFileArray status "$1"
+ declare -r procs=$(cat $4)
+
+ getFileArray status "$2"
set -- ${status[0]}
case "$1" in
killed by sending a SIGKILL signal. Please investigate the reasons
and/or increase the timeout in apps/vshelper/sync-timeout."
;;
- (TIMEOUT|\?\?\?|*) warning $"\
+
+ (TIMEOUT) warning $"\
+A timeout occured while waiting for the vserver to finish and it will
+be killed by sending a SIGKILL signal. The following process list
+might be useful for finding out the reason of this behavior:
+
+----------------------------------------------------------------------
+${procs:+$procs
+}----------------------------------------------------------------------"
+ ;;
+
+ (\?\?\?|*) warning $"\
internal error: 'vwait' exited with an unexpected status '$1'; I will
try to continue but be prepared for unexpected events."
- ;;
+ ;;
esac
return 0
local vwait_pid=$4
if test -d "$vwait_statdir"; then
- _waitForVWait "$vwait_statdir/fifo" "$( <$vwait_statdir/pid )"
+ _waitForVWait "$cfgdir" "$vwait_statdir/fifo" "$( <$vwait_statdir/pid )" "$vwait_statdir/procs"
elif test -n "$_NEED_VSHELPER_SYNC"; then
$_VSHELPER_SYNC "$fifo" "$VSHELPER_SYNC_TIMEOUT" || \
warning $"\