#!/bin/bash
RunCmd=CreoleRun
activer_nextcloud=$(CreoleGet activer_nextcloud non)
container_path_web=$(CreoleGet container_path_web non)

rm -f /etc/cron.d/nextcloud

if [ "$activer_nextcloud" == "oui" ]
then
    rm -rf ${container_path_web}/var/www/nextcloud/nextcloud.db
    cp /usr/share/envole/eoledb/nextcloud ${container_path_web}/var/www/nextcloud/nextcloud.db

	# Executer la montée de version
    $RunCmd "systemctl stop nextcloud.timer" web
	$RunCmd "/var/www/nextcloud/maj-nextcloud.sh" web
	$RunCmd "systemctl start nextcloud.timer" web
	$RunCmd "systemctl enable nextcloud.timer" web
else
	$RunCmd "systemctl stop nextcloud.timer" web
	$RunCmd "systemctl disable nextcloud.timer" web
fi

exit 0

