Greetings - I’ve been researching how to have an external script activate after a file has been uploaded to a particular folder. This file will get into the folder either via the NC web gui or via the NC Desktop Client. Since my dev platform was a little old, I spun up a brand new NC 21 (21.0.2) on Debian 10.
a) Flow Tagging and External Scripts were installed and enabled.
b) create 2 folders, Mach1 and Mach2, for which the folders are tagged Mach1 and Mach2 respectively. I also created 2 additional system tags, Mach1Upload and Mach2Upload. All 4 tags are invisible since this is an automated process. I don’t need users to accidentally tag something that shouldn’t be tagged with these. (Mach2 isn’t begin used in this example, it’s for future use).
c) change NC settings from Ajax to Cron.
d) run the sudo -u www-data php -f /var/www/html/nextcloud/cron.php first to test, and then actually put it into a crontab.
e) from other users’ input, the actual flow is to “autotag the files that are not folders with Mach1 as Mach1Upload”, then “ExternalScript any Mach1Upload tags”.
f) NC does auto-tag the files within Mach1 folder as Mach1, and the Flow tagging does re-tag those files (and not folders) as Mach1Upload correctly and as expected.
g) the script in /var/www/html/nextcloud/scripts/test.sh has execute permissions and the folder and files are owned by www-data. The script itself is simply:
#/bin/sh echo "YAY" > /var/www/html/nextcloud/scripts/test.log
h) running the script as www-data does execute and create the test.log file.
i) To all intents, the cron.php just doesn’t do anything. Running it manually immediately returns complete.
j) I added a var_dump($joblist); into the cron.php (and made sure permissions were ok) however that seems to stall the cron.php indefinitely. Removing the print returns the cron.php to executing and exiting instantly without errors.