0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-03-14 10:35:07 +01:00
nextcloud-docker/docker-occ.sh
Daniel Rudolf d3b7a6483d
Add occ and occ-cron scripts
This allows easier access to `occ` and `occ-cron` within the container.

Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
2024-07-23 16:21:25 +02:00

14 lines
562 B
Bash
Executable file

#!/bin/sh
set -eu
[ -e /var/www/html/occ ] || { echo "Unable to run \`occ\`: No such file or directory" >&2 ; exit 1 ; }
[ -f /var/www/html/occ ] || { echo "Unable to run \`occ\`: Not a file" >&2 ; exit 1 ; }
RUN_AS="$(stat -c %U /var/www/html/occ)"
[ -n "$RUN_AS" ] && [ "$RUN_AS" != "UNKNOWN" ] || { echo "Unable to run \`occ\`: Failed to determine www-data user" >&2 ; exit 1 ; }
if [ "$(id -u)" == 0 ]; then
exec su -p "$RUN_AS" -s /bin/sh -c 'exec php -f /var/www/html/occ -- "$@"' -- '/bin/sh' "$@"
else
exec php -f /var/www/html/occ -- "$@"
fi