Compare commits

...

2 Commits

View File

@ -4,13 +4,6 @@
# This should be added to root's crontab with the full path, such as:
# */5 * * * * /opt/Docker/Config/Nextcloud/cron.ksh
# TODO / TBD
# - Install cron -y on nc-app.
# - Ensure */5 * * * * /var/www/html/cron.php is an entry for www-data.
# - Ensure service cron is started and running.
# - Remove the entry for this file under root on the Docker server.
# - Test that everything works after an update and reboot of both NC + Docker.
# Check if a job is already going.
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
@ -19,32 +12,44 @@ if (( $RUNNING > 0 )); then
exit $RUNNING
fi
verbose=""
case "$1" in
"-h")
function usage() {
cat <<- EOF
Script to help with scheduling Nextcloud's cron requirements.
Usage: $PROG [-h|-v]
-h) Display the usage and help text.
-v) Pass a verbose request to cron.php.
EOF
exit 0
exit $1
}
verbose=""
case "$1" in
"") ;;
"-h")
usage 0
;;
"-v")
verbose="-v"
;;
*)
echo "ERROR: Unknown parameter '$1', exiting."
$DIR/$PROG -h
echo -e "ERROR: Unknown parameter '$1'. Exiting.\n"
usage 1
;;
esac
# 2023-08-25 From crontab.
# Keep ownership correct and apps up to date. Also exists in fixes.sh.
sh -c "docker exec -i nc-app chown -Rc www-data:www-data ."
# No longer update apps in advance of NC updates, allow the upgrade process to do it.
#sh -c "docker exec -itu www-data nc-app ./occ app:update --all"
# Prepare the variables being passed to the execution command.
if [[ -f $DIR/.env ]]; then
source $DIR/.env
else
PHP_MEMORY_LIMIT=256M
fi
# Main part of what would go in the crontab.
sh -c "
docker exec nc-app \
sudo -u www-data \
@ -54,9 +59,4 @@ sh -c "
-f cron.php $verbose \
"
# 2023-08-25 From fixes.sh, keep ownership correct and apps up to date.
sh -c "docker exec -i nc-app chown -Rc www-data:www-data ."
# No longer update apps in advance of NC updates, allow the upgrade process to do it.
#sh -c "docker exec -itu www-data nc-app ./occ app:update --all"
exit 0