Friday, November 8, 2024

permission – Can restic backup macOS Images library from launchd?

Once I run restic from a commandline with sudo it’s truly capable of backup my Images library. However that is most likely as a result of I’ve given Terminal full disk entry.

I’m truly beginning restic from a script of my very own. Nevertheless it works high-quality.

I even have created a launchd schedule. However when it runs from there, I get these permissions errors, like:

scan: open /Customers/gerben/Photos/Images Library.photoslibrary: operation not permitted

The launchd plist accommodates:

    <key>ProgramArguments</key>
    <array>
        <string>/decide/native/and many others/restic/rna-run-restic.sh</string>

That script, which is multi-system, so can run on macOS and on Linux with docker, begins with

#!/bin/bash
# R&A restic interface script

# Make shure we're working bash >4
if [ -n "$BASH_VERSION" ]; then
    # Extract the main model quantity (first quantity) of BASH_VERSION
    major_version="${BASH_VERSION%%.*}"

    # Examine if the main model is lower than 5
    if [ "$major_version" -lt 5 ]; then
        # Re-execute the script with /decide/native/bin/bash
        exec "/decide/native/bin/bash" "$0" "$@"
    fi
else
    # Re-execute the script with /decide/native/bin/bash
    exec "/decide/native/bin/bash" "$0" "$@"
fi

And sooner or later on macOS, this launches /decide/native/bin/restic (put in by MacPorts) with the right arguments, e.g. one thing like:

/decide/native/bin/restic --verbose -p -passwd.txt -r relaxation:https://fqdn:port/ backup --host foo --tag footage --files-from /decide/native/and many others/restic/and many others/foo-includes-pictures.txt

However whereas from Terminal, I can run that backup, I can’t from launchd. How do I repair that?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles