Hello @lkuhnert, welcome to the forum!
The “fix” for this depends on what you’re trying to accomplish.
It sounds like you want to be able to plug in a USB drive and have Duplicati kick off a backup - which you’ve accomplished with the scheduler trigger. I’m a little unclear on what you mean about the log not writing in the database - do you mean that if you run the web interface you don’t see the job execution history?
As far as starting the job BEFORE attaching the drive, I would expect the job to error out because the destination isn’t available. But if it’s not doing that, then you could consider using the
--alternate-destination-marker=<file name> parameter which allows you to specify that a particular file must exist in the destination drive root OR the destination folder for the job to continue.
That way if the job starts but the drive isn’t attached then the file won’t be found and the job should quit.
Another option to consider is a
--run-script-before-required script call in which you could check for a particular drive letter or file existence yourself. You could even have the script check file dates in the destination and not let the job run if it’s been less than X minutes / hours since the last destination file was changed.
This opens the door for scheduling with the web GUI on a frequent schedule (say every 10 minutes) that could look something like this:
- start script every 10 min
- if drive not found stop job
- if drive found check dates in destination
- if most recent date less than 4 hours ago stop job
- if most recent date MORE than 4 hours ago allow job
- backup runs
With a setup like that, a backup would run within 10 minutes of the USB drive being plugged in but ONLY if it’s been at least 4 hours since the last time a file was backed up.