Sample Header Ad - 728x90

tar command in backup script throws cannot open destination tgz file when run from cron

2 votes
1 answer
46 views
I have two external USB hard drives. I have a script that executes tar on one external drive files and puts the tgz another USB external drive. like below : /usr/bin/tar czpf /Volumes/BackupTmp/burocracia-$DATE_STR.tgz /Volumes/Burocracia $DATE_STR is a variable defined at the top of the script. When run from the command line fine. When run from cron of my regular user, the tar commands print : tar: Failed to open '/Volumes/BackupTmp/burocracia-2024-10-15.tgz' the cron configuration is : 0 23 */1 * * /bin/bash -c "/Users/dlsa/bin/backup-attached-disks.sh 1> /Users/dlsa/backup-attached-disks.out 2>&1" I have looked on the Internet, and always sugestions to put it in root's crontab. But I don't want to do that. I want it to run under my user. Which it is, I've checked in the logs. Thanks, Regards
Asked by dlsa (161 rep)
Oct 15, 2024, 11:35 PM
Last activity: Oct 17, 2024, 08:18 AM