skip to Main Content

I try to execute the following line:

docker exec --user www-data nextcloud_docker php /var/www/html/occ db:convert-filecache-bigint

which returns a prompt:

This can take up to hours, depending on the number of files in your instance!
Continue with the conversion (y/n)? [n]

Unfortunately the docker exec command ends (returns to shell) and I am not able to start the occ command.

How can I solve this?

Thanks.

2

Answers


  1. You can try setting the -i flag on the docker command and piping a ‘y’ into it, like this

    echo y | docker exec -i --user www-data nextcloud_docker php /var/www/html/occ db:convert-filecache-bigint
    

    or you can run the command fully interactively with the -it flags like this

    docker exec -it --user www-data nextcloud_docker php /var/www/html/occ db:convert-filecache-bigint
    
    Login or Signup to reply.
  2. occ has a -n switch.
    I run it from cron, including the update. I have these lines in /home/update-nextcloud-inside-container.sh inside my container:
    #!/bin/bash

    date

    sed -i 's~www-data:/var/www:/usr/sbin/nologin~www-data:/var/www:/bin/bash~g' /etc/passwd
    
    su -c "cd /var/www/nextcloud; php /var/www/nextcloud/updater/updater.phar --no-interaction" www-data
    
    su -c "cd /var/www/nextcloud; ./occ db:add-missing-indices -n" www-data
    
    su -c "cd /var/www/nextcloud; ./occ db:convert-filecache-bigint -n" www-data
    
    sed -i s~www-data:/var/www:/bin/bash~www-data:/var/www:/usr/sbin/nologin~g /etc/passwd
    

    and the host cron launches a script with these lines:

    ActiveContainer=$(/home/myusername/bin/lsdocker.sh | grep next )
    
    docker exec -i ${ActiveContainer} /home/update-nextcloud-inside-container.sh
    

    I see now I am missing taking the instance off-line for running convert-filecache. I’ll have to add that.

    Edit: (lsdocker.sh is a script that uses docker ps to list just the active container names)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search