I have solve this problem by writing an simple auto_scan.sh.
I use docker for nextcloud server,and when starting docker,i run this script at the same time.
Here is the script
#!/bin/bash
DIRECTORY=“/root/data/docker_data/nextcloud/data/data/lh”
COMMAND=“sudo docker exec --user www-data nextcloud-app /var/www/html/occ files:scan lh”
eval “$COMMAND”
监视文件夹变化
while inotifywait -r -e modify,create,delete “$DIRECTORY”
do
# 执行命令
echo “文件夹发生变化,执行命令: $COMMAND”
sleep 5
eval “$COMMAND”
done
change DIRECTORY and COMMAND to yours,and save it.
run ./auto_scan.sh and then it’s solved.
if you want to put the program into the background,you can use the screen for it.