Executing nextcloudcmd as cronjob on raspberry pi


I have a nextcloud server set up on a hosted root server.
On the client side, I want a raspberry pi to create a backup of the data every day.
For that reason, I execute the following script, which works perfectly when I put it into the shell directly.

nextcloudcmd -s --trust --non-interactive -h -u <my_actual_user> -p <my_actual_password> /media/nextcloud-backup/<my_actual_user> https://the_url_to_the_external_server

As soon as I put that exact command into a shell script and try to execute it via crontab, it seems that the nextcloud command isn’t executed.
I don’t get an error message and I see that the script is executed, because I added some "echo " statements which I redirect into a file.

I totally don’t know if that’s related or not, but I can’t redirect the output of the nextcloudcmd call into a file. It will always show up directly in the terminal, when I execute the command.

1 Like