nextcloud-cronjob/scripts/cron-tasks.sh
Robert Dailey ab6372fa79 Provide the ability to run user-defined cron tasks
Mount individual shell scripts (with the `*.sh` extension) inside `/cron-scripts/` in the
container. The cron daemon will automatically run these scripts inside the Nextcloud
container for you. Write the scripts as if they will run in the Nextcloud container
itself.
2018-12-06 17:58:26 -06:00

17 lines
555 B
Bash
Executable file

#!/usr/bin/env bash
set -e
echo "-------------------------------------------------------------"
echo " Executing Cron Tasks: $(date)"
echo "-------------------------------------------------------------"
# Loop through all shell scripts and execute the contents of those scripts in the Nextcloud
# container. It's done this way so that the user may mount more scripts to be executed in addition
# to the default ones.
cd /cron-scripts
for script in *.sh; do
echo "> Running Script: $script"
docker exec -i "$1" bash < $script
done
echo "> Done"