since I can’t get the workflow “automatic media converter” to work on my nextcloud, I was wondering: Can I use cron.php to trigger a bash script to convert videos?
My current setup:
NC 24.0.11 on armbian 23 on an Odroid HC4
I manually run a bash script via cli which loops through videofiles and converts them using ffmpeg. Additionally, it triggers a files:scan in occ.php
What doesn’t work:
Automatic Media Conversion Flow
What I plan to do:
having a cron job that checks if new video files have been created/copied in specific directories and then start conversion via ffmpeg. I’d like to avoid having a cronjob activating my hdd every 15 min, to let it get “some sleep” That’s why I’m asking about nextcloud’s cron.php. This job checks for new files via the database, correct? My database is not on my hdd but on the sd card with the OS.
I suspect you would need to write a custom app that registers a cron-like job that will query the file cache. Depending on the state, you might (or not) do further steps like invoking an external (and asynchronous!) shell script with ffmpeg involved.
I am unsure, if this approach will keep the HDD offline, to be honest. Just the slightest query on the file system will spin it up. You could create a minimalistic app and see with it if it can query the paths without spinning up.
However, there is one issue, I am seeing with this whole approach: How did the file get to the HDD in the first moment?
It it was via NC, you could as well try to get some notifications upon the event using the core.
In case it is written externally or on an external storage, you will need to sync the file system with the NC internal cache. So, it will need a spinning disk to do so…
One (non-NC-related) idea, I am having: I suspect you are running in a small environment (like RPI) and want to save power. Are you running some Linux flavor? You could use inotify (aka inotifywait and inotifywatch) to trigger without use of the NC the ffmepg call before the disk spins down at all.
Thanks! Indeed, the environment is an sbc (a Hardkernel Odroid HC4), running Armbian Jammy (Ubuntu 23). And although it is a good HDD, I thought about power-saving. My reckoning was: the nc-database knows if a new file was uploaded (via browser/desktop/mobile app, these are common ways files get to my nc), so I could use this mechanism. But your proposal (using inotify) makes much more sense, I guess.