Update comments, rearrange file, fix case statement and handle empty parameter correctly.
This commit is contained in:
@ -19,32 +19,44 @@ if (( $RUNNING > 0 )); then
|
|||||||
exit $RUNNING
|
exit $RUNNING
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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 $1
|
||||||
|
}
|
||||||
|
|
||||||
verbose=""
|
verbose=""
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
"") ;;
|
||||||
"-h")
|
"-h")
|
||||||
cat <<- EOF
|
usage 0
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
"-v")
|
"-v")
|
||||||
verbose="-v"
|
verbose="-v"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: Unknown parameter '$1', exiting."
|
echo -e "ERROR: Unknown parameter '$1'. Exiting.\n"
|
||||||
$DIR/$PROG -h
|
usage 1
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
if [[ -f $DIR/.env ]]; then
|
||||||
source $DIR/.env
|
source $DIR/.env
|
||||||
else
|
else
|
||||||
PHP_MEMORY_LIMIT=256M
|
PHP_MEMORY_LIMIT=256M
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Main part of what would go in the crontab.
|
||||||
sh -c "
|
sh -c "
|
||||||
docker exec nc-app \
|
docker exec nc-app \
|
||||||
sudo -u www-data \
|
sudo -u www-data \
|
||||||
@ -54,9 +66,4 @@ sh -c "
|
|||||||
-f cron.php $verbose \
|
-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
|
exit 0
|
||||||
|
Reference in New Issue
Block a user