nextcloud-cronjob/scripts/nextcloud-exec.sh

20 lines
611 B
Bash
Raw Normal View History

#!/usr/bin/env bash
nextcloud_exec_no_shell() {
containerId="$1"; shift
# If a user must be specified when executing the task, set up that option here.
# You may also leave NEXTCLOUD_EXEC_USER blank, in which case it will not be used.
if [[ -n "$NEXTCLOUD_EXEC_USER" ]]; then
exec_user="--user $NEXTCLOUD_EXEC_USER"
fi
2023-11-09 09:18:19 +01:00
# shellcheck disable=SC2086
docker exec $exec_user "$containerId" "$@"
}
nextcloud_exec() {
containerId="$1"; shift
2023-11-09 09:18:19 +01:00
# shellcheck disable=SC2086
nextcloud_exec_no_shell "$containerId" "$NEXTCLOUD_EXEC_SHELL" $NEXTCLOUD_EXEC_SHELL_ARGS "$@"
}