2018-12-02 02:08:31 +01:00
|
|
|
#!/usr/bin/env bash
|
2018-12-07 00:30:27 +01:00
|
|
|
set -e
|
2023-11-09 09:03:00 +01:00
|
|
|
[[ -n "$DEBUG" ]] && set -x
|
2018-12-02 02:08:31 +01:00
|
|
|
|
2023-11-09 09:07:39 +01:00
|
|
|
# shellcheck disable=SC1091
|
2020-08-28 21:52:50 +02:00
|
|
|
source /nextcloud-exec.sh
|
|
|
|
|
2018-12-02 02:08:31 +01:00
|
|
|
if [[ -z "$NEXTCLOUD_CONTAINER_NAME" ]]; then
|
|
|
|
echo "NEXTCLOUD_CONTAINER_NAME is a required variable"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-08-28 21:45:17 +02:00
|
|
|
# Print info about how we will look for Nextcloud
|
|
|
|
if [[ -n "$NEXTCLOUD_PROJECT_NAME" ]]; then
|
|
|
|
echo "Will search for Nexcloud container as a Docker Compose service"
|
|
|
|
echo "Project: $NEXTCLOUD_PROJECT_NAME, Service: $NEXTCLOUD_CONTAINER_NAME"
|
|
|
|
else
|
|
|
|
echo "Container Name: $NEXTCLOUD_CONTAINER_NAME"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Do an initial search for the container to rule out any configuration problems
|
|
|
|
containerId="$(/find-container.sh)"
|
|
|
|
if [[ -z "$containerId" ]]; then
|
|
|
|
echo "ERROR: Unable to find the Nextcloud container"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Found Nextcloud container with ID $containerId"
|
|
|
|
fi
|
|
|
|
|
2020-08-28 21:52:50 +02:00
|
|
|
# Verify the chosen shell exists in the Nextcloud container
|
|
|
|
if ! nextcloud_exec_no_shell "$containerId" sh -c "command -v \"$NEXTCLOUD_EXEC_SHELL\"" >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
echo "ERROR: Shell \"$NEXTCLOUD_EXEC_SHELL\" does not exist in the Nextcloud container"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Chosen shell \"$NEXTCLOUD_EXEC_SHELL\" was found in the Nextcloud container"
|
|
|
|
fi
|
|
|
|
|
2019-06-21 02:15:55 +02:00
|
|
|
echo "*/$NEXTCLOUD_CRON_MINUTE_INTERVAL * * * * /cron-tasks.sh" \
|
2018-12-02 02:08:31 +01:00
|
|
|
> /var/spool/cron/crontabs/root
|
|
|
|
|
2019-02-03 19:46:12 +01:00
|
|
|
echo "Starting crond"
|
|
|
|
exec crond -f -l 0
|