Skip to content

Instantly share code, notes, and snippets.

@Mons
Created April 26, 2025 12:55
Show Gist options
  • Save Mons/6969a07dedd486d3c52a43727a3a17e6 to your computer and use it in GitHub Desktop.
Save Mons/6969a07dedd486d3c52a43727a3a17e6 to your computer and use it in GitHub Desktop.
entrypoint.sh
#!/bin/bash
if [ $$ -eq 1 ]; then
echo "Starting as init, set signal handlers..."
trap exit SIGTERM SIGINT
fi
set -ex
# prepare
set +x
if [ -z "$1" ]; then
echo "Sleeping..."
sleep infinity &
else
echo "Running command"
"$@" &
fi
wait %1
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment