+function DisableMaintenanceMode() {
+ echo "Switching off maintenance mode..."
+ cd "${nextcloudFileDir}"
+ sudo -u "${webserverUser}" php occ maintenance:mode --off
+ cd ~
+ echo "Done"
+ echo
+}
+
+# Capture CTRL+C
+trap CtrlC INT
+
+function CtrlC() {
+ read -p "Backup cancelled. Keep maintenance mode? [y/n] " -n 1 -r
+ echo
+
+ if ! [[ $REPLY =~ ^[Yy]$ ]]
+ then
+ DisableMaintenanceMode
+ else
+ echo "Maintenance mode still enabled."
+ fi
+
+ exit 1
+}
+