The Downside
cp -R {goal} {dest} provides ‘Operation not permitted’ error throughout background backup script execution
See the code from com.consumer.backup.plist and backup-script.sh under.
What I’ve Tried
I attempted to go to System Settings > Privateness & Safety > Full Disk Entry to grant entry to the backup script ~/backup-script.sh which is an executable (-rwxr-xr-x@) that’s executed by ~/Library/LaunchAgents/com.consumer.backup.plist each Saturday at 03:00 h however after utilizing Cmd+Shift+. to indicate all information, I nonetheless can not choose it. My subsequent concept could be to attempt to grant launchd itself full disk entry, however this looks like a Dangerous Conceptâ„¢ security-wise.
Moreover serving to with my system right here, which is nice when ran from the command line –
What are individuals doing to backup explicit directories moreover simply utilizing Time Machine?
My System
sw_vers
% :: sw_vers 13:15:42 (130)
ProductName: macOS
ProductVersion: 15.6.1
BuildVersion: 24G90
~/Library/LaunchAgents/com.consumer.backup.plist
Label
com.consumer.backup
ProgramArguments
/Customers/consumer/backup-script.sh
StartCalendarInterval
Hour
3
Minute
0
Weekday
6
StandardErrorPath
/tmp/backup.err
StandardOutPath
/tmp/backup.out
RunAtLoad
~/backup-script.sh
#!/bin/bash
### ----------------
### Disk Capacities
### ----------------
### A administration process ought to be to prune these directories, after which check the
### /Customers/consumer/cleanup-script.sh --dry-run (utilizing the dry-run flag) and tail -f to observe logfiles
### ----------------
### Configuration
### ----------------
# Outline directories and/or information to again up
# _Exclude_ trailing / from directories for cp -R's anticipated habits!
BACKUP_TARGETS=(
"target1"
"target2"
)
### ----------------
### Configuration
### ----------------
# Outline exterior volumes
# Deliberately withheld closing "https://apple.stackexchange.com/"
VOLUMES=(
"/Volumes/Exterior/Backups"
"/Volumes/Samsung USB/backups"
)
### ----------------
### Configuration
### ----------------
### Logging
### ----------------
# Set the logfile listing
# If on startup this listing does not exist, the script will give up
# and instruct the administrator to specify the LOGFILE_DIR
# and make sure that different configuration variables like BACKUP_DIRS
# are correctly set
LOGFILE_DIR="/Customers/consumer/backup-cleanup-logs"
if [ ! -d "$LOGFILE_DIR" ]; then
error_LOGFILE_DIR_not_exists=$(cat <> "$LOGFILE"
else
echo "Error backing up $DIR to $BACKUP_PATH." >> "$LOGFILE"
fi
finished
finished
}
# Run backup perform
backup
echo "Completed backing up..."
