I am having errors while running duplicity in macOS (crontab)
The duplicity command is as follows (works in Command-line)
/usr/local/bin/duplicity /Users/myname/go file:///Volumes/EVO840\ -\ IMPORTANT/DuplicityGo/ --exclude '**/bin/***' --exclude '**/pkg'
When using crontab -e
(with and without sudo),
* * * * * /Users/myname/bashscripts/duplicity.sh > /Users/myname/bashscripts/duplicity.log 2>&1
it returns following error
Traceback (innermost last):
File "/usr/local/bin/duplicity", line 87, in <module>
with_tempdir(main)
File "/usr/local/bin/duplicity", line 72, in with_tempdir
tempdir.default().cleanup()
File "/usr/local/Cellar/duplicity/0.8.23/libexec/lib/python3.9/site-packages/duplicity/tempdir.py", line 69, in default
_defaultInstance = TemporaryDirectory(temproot=config.temproot)
File "/usr/local/Cellar/duplicity/0.8.23/libexec/lib/python3.9/site-packages/duplicity/tempdir.py", line 155, in __init__
temproot = subprocess.check_output([u'getconf', u'DARWIN_USER_TEMP_DIR'])
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'getconf'
Attempt of list Nr. 1 failed. PermissionError: Operation not permitted
Attempt of list Nr. 3 failed. PermissionError: Operation not permitted
Attempt of list Nr. 4 failed. PermissionError: Operation not permitted
cron often has no or a limited PATH env var set only. set it on top of your crontab to the same value you use in your commandline and the error will likely vanish.
I found out that the problem arises from me using Removable Volume as destination for duplicity.
In order for my bash script to work (or even just running duplicity in crontab), I have to add /bin/bash to Full Disk Access (though, I think it's feels unsafe)