[Solved] NCP: How to run occ command?

After updating to Nextcloud 20.0.4 and NCP 1.33, my NC wants me to run some occ commands (e. g. db:add-missing-indices etc.). Found in another thread that I have to run a docker exec command like “sudo docker exec -it nextcloudpi sudo -u www-data /var/www/nextcloud/occ db:add-missing-indices”, but it says “command not found”. How I have to run occ commands in NCP (installed @Raspberry Pi 4)?
Thanks in advance!

If you don’t use docker you don’t need the docker prefix in the command, just try something like that.

sudo -u www-data /var/www/nextcloud/occ db:add-missing-indices

But my NextcloudPi is installed with Docker.
Found the solution: With NCP, it seems that you have to execute occ commands with the wrapper “ncc”. This command works for me:

sudo su
docker exec -it nextcloudpi ncc db:add-missing-indices
3 Likes

A nice way to not write the docker exec ... everytime, is to use an alias:
alias occ="sudo docker exec -ti --user www-data nextcloud-aio-nextcloud /var/www/html/occ"
So running occ db:add-missing-indices works easily.

1 Like