NextcloudCMD without GUI

We will install and configure the Nextcloudclient (nextcloudcmd) 2.3.3 to sync all data headless and without any gui to your or federated Nextcloud Server silently. Therefore we will add the Nextcloud repository as root to your Ubuntu Server, install the Nextcloud client, create a shell script and configure a cronjob to sync your data automatically. Let’s start:

sudo -s
add-apt-repository ppa:nextcloud-devs/client

Then we run “apt update” and instal the Nextcloud Client:

apt update && apt install nextcloud-client

Create a shell script to sync your data:

vi /root/

Paste the following rows:

echo "-------------------------------------"
echo " START: $(date)"
echo "-------------------------------------"
nextcloudcmd -v
echo "-------------------------------------"
echo " NextcloudCMD by C-RIEGER.DE ..."
nextcloudcmd -u "YourUser" -p "Your-APP-Pass-Word" -s /your/local/path/
echo "-------------------------------------"
echo " END: $(date)"
echo "-------------------------------------"
mail -s "NextcloudCMD" -a "From: Your Name <>"< /home/ubuntuuser/bkup/nccmd.txt
exit 0

Substitute all the red ones properly. Save and quit the file (:wq!) and make the script executable:

chmod +x /root/

Create a cronjob to sync your data @hourly:

crontab -e

Paste the following row:

@hourly /root/ > /home/ubuntuuser/bkup/nccmd.txt 2>&1

Verify, if the sync is working well by running:

/root/ > /home/ubuntuuser/bkup/nccmd.txt 2>&1

You should receive an email that looks like:

START: So 07. Jan 08:02:03 CEST 2018
nextcloudcmd version 2.3.3
/NextcloudCMD by C-RIEGER.DE…
END: So 07. Jan 08:02:07 CEST 2018

From now, all your data will be synced hourly.

Carsten Rieger

Leave a Reply

Your email address will not be published. Required fields are marked *