Nextcloud version 19.0.1:
Operating system and version (Arch):
I set up Nextcloud on a linux server with docker. Is there any chance to run the command occ files-scan --all
with some āchangesā inside the web interface (not terminal) e.g. in settings? My docker container donāt know anything about commands like āsudoā or ācrontabā, so i want to realize this inside the web interface.
Couldnāt find a solution inside web interface. I created a crontab on my host like this:
sudo docker exec -ti --user www-data nextcloud-app /var/www/html/occ files:scan --all
Well, nope, need help anyway.
sudo docker exec -ti --user www-data nextcloud-app /var/www/html/occ files:scan --all
is working like a charm. Now i want to use this as crontab:
sudo su
crontab -e
adding this line:
0 12 * * * sudo docker exec -ti --user www-data nextcloud-app /var/www/html/occ files:scan --all
-> run everyday this command at 12:00. But nothing is happening. Why? If i do something simpler like 0 12 * * * echo "test" > test.txt
its working perfect - its creating a file ātest.txtā. So syntax is correct. Any idea?
Also tried this way:
- go inside docker container
sudo docker exec -it nextcloud-app /bin/bash
apt install -y cron
apt install -y sudo
sudo crontab -e
- add
0 12 * * * sudo -u www-data /var/www/html/occ files:scan --all
This is not working. So a cron inside a docker container also dont work. Tried the echo
example above inside container, but this also dont work.
root@287338265e0d:/var/www/html# /etc/init.d/cron status [FAIL] cron is not running ... failed!
Edit: So stupid, i had to activate this:
/etc/init.d/cron start
Now the cron is running inside the docker container and the occ
commands runs well.
which image?
on my system:
docker exec -u www-data nextcloud-app php occ files:scan --all
works.
1 Like