39 lines
1.1 KiB
Bash
Executable file
39 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -u
|
|
set -e
|
|
|
|
echo "== Running before-starting hooks as $(id -un) user =="
|
|
|
|
# wait for nextcloud to be initialized
|
|
WORKDIR=/var/www/html
|
|
counter=0
|
|
while [ ! -d "$WORKDIR" ] && [ "$counter" -lt 120 ]; do
|
|
echo "GX:BEFORE-STARTING:WAITING"
|
|
counter=$((counter+1))
|
|
sleep 1
|
|
done
|
|
cd "$WORKDIR" || exit 1
|
|
|
|
echo "GX:BEFORE-STARTING:START ($(pwd))"
|
|
# find . -maxdepth 1
|
|
echo "GX:BEFORE-STARTING:STATUS"
|
|
php -d memory_limit=-1 occ status
|
|
# INSTALLED="$(php -d memory_limit=-1 occ status |jq -r '.installed')"
|
|
if php -d memory_limit=-1 occ status 2>&1 | grep -q 'not installed' ; then
|
|
echo "WARNING: Nextcloud is not installed yet. Exiting."
|
|
exit 0
|
|
fi
|
|
|
|
echo "GX:BEFORE-STARTING:UPGRADE"
|
|
php -d memory_limit=-1 occ upgrade
|
|
echo "GX:BEFORE-STARTING:DB"
|
|
php -d memory_limit=-1 occ db:convert-filecache-bigint
|
|
php -d memory_limit=-1 occ db:add-missing-indices
|
|
echo "GX:BEFORE-STARTING:HTACCESS"
|
|
php -d memory_limit=-1 occ maintenance:update:htaccess
|
|
echo "GX:BEFORE-STARTING:MAINTENANCE:OFF"
|
|
php -d memory_limit=-1 occ maintenance:mode --off
|
|
php -d memory_limit=-1 occ maintenance:mode --off || true
|
|
echo "GX:BEFORE-STARTING:END"
|
|
|