Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit out if 'exec' fails #163

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions sbin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ cvmfsexec_local_config=$cvmfsexec_root/dist/etc/cvmfs/default.local
htcondor_supervisord_config=/etc/supervisord.d/10-htcondor.conf


safe_exec () {
exec "$@"
# we should not get here:
fail "Exec failed with $? on command '$*'"
}


add_or_replace () {
local file="$1"
local var="$2"
Expand Down Expand Up @@ -64,10 +71,10 @@ is_true () {
if [[ -d $config_repo ]]; then
echo "OSG CVMFS already available (perhaps via bind-mount),"
echo "skipping cvmfsexec."
exec "$@"
safe_exec "$@"
elif [[ ! $CVMFSEXEC_REPOS =~ [a-z]+ ]]; then
echo "No CVMFS repos requested, skipping cvmfsexec."
exec "$@"
safe_exec "$@"
fi
CVMFSEXEC_REPOS=$(tr -s ',' ' ' <<<"$CVMFSEXEC_REPOS")

Expand Down Expand Up @@ -105,8 +112,8 @@ fi

if [[ $1 == /usr/local/sbin/supervisord_startup.sh ]]; then
# If we're starting the pilot then run cvmfsexec under tini so signals are propagated
exec tini $cvmfsexec_root/cvmfsexec -- -N $CVMFSEXEC_REPOS -- "$@"
safe_exec tini $cvmfsexec_root/cvmfsexec -- -N $CVMFSEXEC_REPOS -- "$@"
else
# If we're exec'ing in or running an alternate command, then just run cvmfsexec.
exec $cvmfsexec_root/cvmfsexec -N $CVMFSEXEC_REPOS -- "$@"
safe_exec $cvmfsexec_root/cvmfsexec -N $CVMFSEXEC_REPOS -- "$@"
fi
Loading