1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-05 19:42:11 +02:00

Add ability to ignore failures in execution of container CTL_ON_* commands

This will allow to use register in CTL_ON_CREATE and not abort if used with
existing data that have account already registered.
This commit is contained in:
Paweł Chmielowski 2024-02-13 11:55:12 +01:00
parent cdaf45f91c
commit 67a6776fba
2 changed files with 18 additions and 8 deletions

View file

@ -331,13 +331,18 @@ post_waiter_loop()
LIST=$@
HEAD=${LIST%% ; *}
TAIL=${LIST#* ; }
echo ":> ejabberdctl $HEAD"
$0 $HEAD
HEAD2=${HEAD#\! *}
echo ":> ejabberdctl $HEAD2"
$0 $HEAD2
ctlstatus=$?
if [ $ctlstatus -ne 0 ] ; then
echo ":> FAILURE in command '$HEAD' !!! Stopping ejabberd..."
$0 halt > /dev/null
exit $ctlstatus
if [ "$HEAD" != "$HEAD2" ] ; then
echo ":> FAILURE in command '$HEAD2' !!! Ignoring result"
else
echo ":> FAILURE in command '$HEAD' !!! Stopping ejabberd..."
$0 halt > /dev/null
exit $ctlstatus
fi
fi
[ "$HEAD" = "$TAIL" ] || post_waiter_loop $TAIL
}