Merge pull request 'Nextcloud Improvements' (#3) from dev into main

Reviewed-on: #3
This commit is contained in:
2025-06-16 12:30:19 -07:00
3 changed files with 52 additions and 6 deletions

1
.gitignore vendored
View File

@ -37,3 +37,4 @@ Config/Hyperling.com/files/*
# Ignore things like Config/Hyperling.com-Stage/ # Ignore things like Config/Hyperling.com-Stage/
*-Stage *-Stage
Stage-*

View File

@ -4,19 +4,64 @@
# This should be added to root's crontab with the full path, such as: # This should be added to root's crontab with the full path, such as:
# */5 * * * * /opt/Docker/Config/Nextcloud/cron.ksh # */5 * * * * /opt/Docker/Config/Nextcloud/cron.ksh
# Check if a job is already going. DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")" PROG="$(basename -- "${BASH_SOURCE[0]}")"
# Check if a job is already going.
RUNNING=`ps -ef | grep $PROG | grep -v grep | grep -v $$ | grep -v "sh -c" | wc -l` RUNNING=`ps -ef | grep $PROG | grep -v grep | grep -v $$ | grep -v "sh -c" | wc -l`
if (( $RUNNING > 0 )); then if (( $RUNNING > 0 )); then
exit $RUNNING exit $RUNNING
fi fi
# 2023-08-25 From crontab. # Usage function for when -h or bad parameters are passed.
sh -c "docker exec -u www-data nc-app php cron.php --define apc.enable_cli=1" function usage() {
cat <<- EOF
Script to help with scheduling Nextcloud's cron requirements.
Usage: $PROG [-h|-v]
-h ) Display the usage and help text.
| --help
-v) Pass a verbose request to cron.php.
| --verbose
EOF
exit $1
}
# 2023-08-25 From fixes.sh, keep ownership correct and apps up to date. # Check for any parameters.
sh -c "docker exec -it nc-app chown -Rc www-data:www-data ." verbose=""
case "$1" in
"") ;;
"-h"|"--help")
usage 0
;;
"-v"|"--verbose")
verbose="-v"
;;
*)
echo -e "ERROR: Unknown parameter '$1'. Exiting.\n"
usage 1
;;
esac
# 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. # 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" #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 \
php \
-d apc.enable_cli=1 \
-d memory_limit=$PHP_MEMORY_LIMIT \
-f cron.php $verbose \
"
exit 0 exit 0

View File

@ -69,7 +69,7 @@ docker exec -itu www-data nc-app ./occ files:scan-app-data
echo -e "\n`date` - Theme Update" echo -e "\n`date` - Theme Update"
docker exec -itu www-data nc-app ./occ maintenance:theme:update docker exec -itu www-data nc-app ./occ maintenance:theme:update
echo -e "\n`date` - Repair" echo -e "\n`date` - Repair"
docker exec -itu www-data nc-app ./occ maintenance:repair docker exec -itu www-data nc-app ./occ maintenance:repair --include-expensive
# May also be useful but do not have much experience with them. # May also be useful but do not have much experience with them.
echo -e "\n`date` - Clean Versions" echo -e "\n`date` - Clean Versions"