mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-09-02 19:51:32 +00:00
With su-exec, make sure the SIGTERM upon docker stop could be received by the running program thus causing a clean stop/exit. Signed-off-by: Qi Zheng <qi.zheng@intel.com>
16 lines
325 B
Bash
16 lines
325 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# first arg is `-f` or `--some-option`
|
|
# or first arg is `something.conf`
|
|
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
|
|
set -- redis-server "$@"
|
|
fi
|
|
|
|
# change to redis user to run
|
|
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
|
|
exec su-exec redis "$BASH_SOURCE" "$@"
|
|
fi
|
|
|
|
exec "$@"
|