+Update-Skript

This commit is contained in:
phil 2021-08-18 21:08:44 +02:00
parent 6c0cc4e5b9
commit b16548cabf
3 changed files with 41 additions and 1 deletions

View file

@ -6,7 +6,8 @@ nextcloud_admin_user: systemausfall.org
nextcloud_admin_pw: admin
nextcloud_db_password: "{{ lookup('password', '/tmp/{{ instance.domain }}_db_pwd length=42 chars=ascii_letters,digits') }}"
nextcloud_dl_url: https://download.nextcloud.com/server/releases
nextcloud_install_path: "/data/nextcloud/{{ instance.domain }}"
nextcloud_root: /data/nextcloud
nextcloud_install_path: "{{ nextcloud_root }}/{{ instance.domain }}"
nextcloud_config_file: "{{ nextcloud_install_path }}/config/config.php"
nextcloud_php_memory_limit: 512M
nextcloud_php_upload_limit: 512M

View file

@ -25,3 +25,9 @@
copy:
src: roles/nextcloud/files/30-sao.ini
dest: "/etc/php/{{ php_version }}/cli/conf.d/30-sao.ini"
- name: "common: Kopiere Update-Skript"
template:
src: /roles/nextcloud/templates/nextcloud-updater.j2
dest: "{{ local_scripts_dir }}/nextcloud-updater"
mode: 0755

View file

@ -0,0 +1,33 @@
#!/bin/bash
set -e
NEXTCLOUD_ROOT="{{ nextcloud_root }}"
UPDATER="updater/updater.phar"
update_db() {
for j in `find "$NEXTCLOUD_ROOT" -maxdepth 1 -mindepth 1 -type d`
do
USER=$(stat -c %U "$j")
echo "Aktualisiere $j..."
sudo -u "$USER" php "$j"/occ db:convert-filecache-bigint --no-interaction
sudo -u "$USER" php "$j"/occ db:add-missing-indices --no-interaction
done
}
case "$1" in
core-update)
for i in `find "$NEXTCLOUD_ROOT" -maxdepth 1 -mindepth 1 -type d`
do
USER=$(stat -c %U "$i")
echo "Aktualisiere $i..."
sudo -u "$USER" php "$i"/"$UPDATER" --no-interaction
done
;;
db-update)
update_db
;;
*)
echo "Usage: nextcloud-updater {core-update|db-update}"
exit 1
esac