Nextcloud version (eg, 12.0.2): 15.0.2
Operating system and version (eg, Ubuntu 17.04): Debian 9 (stretch)
Apache or nginx version (eg, Apache 2.4.25): nginx/1.10.3
PHP version (eg, 7.1): 7.0.33
The issue you are facing: I am trying to enenable maintenance mode from remote machine using occ command. Therefore I wrote the script beneath.
#!/bin/bash
#
# Name:OnMaintenanceMode.sh
# Description: This script connects to source server. It changes directory to /var/www/nextcloud and activates
# maintenance mode on Nextcloud server.
# Use: JOB level -> Pre-Script
# It should be used before backup jobs will start to cover Nextcloud instance and integrity of data quality.
#
ELKARBACKUP_URL=root@sub.domain.tld:/var/www/nextcloud
URL=`echo $ELKARBACKUP_URL | cut -d ":" -f1` # user@serverip
USER="${URL%@*}" # user
HOST="${URL#*@}" # host
DIR=`echo $ELKARBACKUP_URL | cut -d ":" -f2` # path
SSHPARAMS='-i /var/lib/elkarbackup/.ssh/id_rsa -o StrictHostKeyChecking=no'
ssh $SSHPARAMS $USER@$HOST "cd /var/www/nextcloud | sudo -u www-data php occ maintenance:mode --on"
exit 0
When I now run the script on remote client, the system returns:
pi@nextcloud-bkp:/var/spool/elkarbackup/uploads $ sudo ./0005.script
Could not open input file: occ
pi@nextcloud-bkp:/var/spool/elkarbackup/uploads $
Any idea what is wrong?
Kind regards
//neph