Mounted devices not visible when using script with cron
If I run a script in Terminal eg. diskutil list external it works fine, but when I run the same script via cron the command doesn't have any output and I can't access a mounted USB disk.
Full disk access is allowed for Terminal, cron, smbd and diskutil. A hint from another website points me to remove unnecessary xattrs. I have a xattr named "com.apple.lastuseddate#PS" which I removed with xattr -d.
My script simply check the availability of a USB drive with:
if [[ $(mount | awk '$3 == "/Volumes/TKBackup" {print $3}') != "" ]];
or
if [[ $(diskutil list external | awk '$3 == "TKBackup" {print $3}') != "" ]];
and than use rsync to backup data to this drive. But that doesn't work via cron.
Any hints?