Saturday, November 7, 2026
HomeAppleterminal - underneath macos 10.15.7, why can not cron discover information on...

terminal – underneath macos 10.15.7, why can not cron discover information on my exterior onerous drive?

[ad_1]

I bought an exterior onerous drive
for scheduled backups of my macbook professional,
presumably underneath cron.
My rsync instructions work high quality after I invoke on the bash (interactive) command line.
However as quickly as I attempt to do them underneath cron, they fail.
Actually,
cron can not discover information on the exterior onerous drive.
The code under demonstrates this.

#!/bin/bash
echo ========================================== 
date '+%Y-%m-%d %a %H:%M:%S'
whoami 
printenv
discover -s /Customers/kpr/nDoNotBackup/Dustin /Volumes/oom/tmp -type f  -newermt '2021-12-30'

The script is known as zee.
To place each the interactive command and the cron command into an identical shells, I used
env -i /bin/bash -login -c.
For this, I adopted
https://stackoverflow.com/questions/9671027/sanitize-environment-with-command-or-bash-script.

First interactive:

~/tmplocal/DUMS/zee> env -i /bin/bash -login -c '/Customers/kpr/u/kh/bin/zee >> /Customers/kpr/tmplocal/DUMS/zee/out.txt 2>&1'

after which

~> crontab -l
00 16  *  *  *  $HOME/u/kh/bin/jaw20200410cronmakeccalfile.sh
05 22  *  *  *  env -i /bin/bash -login -c '/Customers/kpr/u/kh/bin/zee >> /Customers/kpr/tmplocal/DUMS/zee/out.txt 2>&1'
~> 

In out.txt, the invocations are distinguishable by their values of PWD.

==========================================
2021-12-30 Thu 22:03:43
kpr
PATH=/bin:/usr/native/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin
PWD=/Customers/kpr/tmplocal/DUMS/zee
SHLVL=2
_=/usr/bin/printenv
/Customers/kpr/nDoNotBackup/Dustin/srczee/Hey
/Volumes/oom/tmp/srczee/Hey
==========================================
2021-12-30 Thu 22:05:00
kpr
PATH=/bin:/usr/native/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin
PWD=/Customers/kpr
SHLVL=2
_=/usr/bin/printenv
/Customers/kpr/nDoNotBackup/Dustin/srczee/Hey
discover: /Volumes/oom/tmp: Operation not permitted

Why would cron trigger this drawback?
How can I run a command so simple as discover, underneath cron, so that it’ll work in addition to within the interactive shell?

Beneath is a few info on the exterior HD and on my macbook’s HD.
Do I have to format the exterior HD in a different way? However then why is it accessible from the command line?

~/u/kh/bin> diskutil information /Volumes/oom
   System Identifier:         disk4
   System Node:               /dev/disk4
   Entire:                     Sure
   A part of Entire:             disk4
   System / Media Identify:       My Passport 260D

   Quantity Identify:               oom
   Mounted:                   Sure
   Mount Level:               /Volumes/oom

   Content material (IOContent):       Apple_HFSX
   File System Persona:   Case-sensitive Journaled HFS+
   Kind (Bundle):             hfs
   Identify (Consumer Seen):       Mac OS Prolonged (Case-sensitive, Journaled)
   Journal:                   Journal measurement 385024 KB at offset 0x48c8000
   House owners:                    Disabled

   OS Can Be Put in:       Sure
   Booter Disk:               disk3s3
   Media Kind:                Generic
   Protocol:                  USB
   SMART Standing:              Not Supported
   Quantity UUID:               3FE9A430-BADA-39B9-8B8A-BBD9F734633D
   Disk / Partition UUID:     D1537CEC-27E9-43EF-86ED-E7A2A7A16C11

   Disk Measurement:                 5.0 TB (5000247902208 Bytes) (precisely 9766109184 512-Byte-Items)
   System Block Measurement:         512 Bytes

   Quantity Whole House:        5.0 TB (5000247902208 Bytes) (precisely 9766109184 512-Byte-Items)
   Quantity Used House:         2.8 TB (2773301460992 Bytes) (precisely 5416604416 512-Byte-Items) (55.5%)
   Quantity Free House:         2.2 TB (2226946441216 Bytes) (precisely 4349504768 512-Byte-Items) (44.5%)
   Allocation Block Measurement:     8192 Bytes

   Learn-Solely Media:           No
   Learn-Solely Quantity:          No

   System Location:           Exterior
   Detachable Media:           Mounted

   Stable State:               Data not accessible
   Digital:                   Sure

   This disk is a Core Storage Logical Quantity (LV).  Core Storage Info:
   LV UUID:                   D1537CEC-27E9-43EF-86ED-E7A2A7A16C11
   LVF UUID:                  6C06FD6C-D00A-4953-AFC3-5D5908487D26
   LVG UUID:                  E80D582C-0EDA-49E0-ADD6-A718B36AAF6A
   PV UUID (disk):            70BC9B73-B6CC-4D90-9DC0-22EC0E5490D3 (disk3s2)
   Fusion Drive:              No
   Encrypted:                 Sure

~/u/kh/bin> diskutil information /
   System Identifier:         disk1s1
   System Node:               /dev/disk1s1
   Entire:                     No
   A part of Entire:             disk1

   Quantity Identify:               Macintosh HD
   Mounted:                   Sure
   Mount Level:               /

   Partition Kind:            41504653-0000-11AA-AA11-00306543ECAC
   File System Persona:   APFS
   Kind (Bundle):             apfs
   Identify (Consumer Seen):       APFS
   House owners:                    Enabled

   OS Can Be Put in:       No
   Booter Disk:               disk1s3
   Restoration Disk:             disk1s4
   Media Kind:                Generic
   Protocol:                  PCI-Specific
   SMART Standing:              Verified
   Quantity UUID:               36033C28-202B-4932-B271-C8BD841FBAAF
   Disk / Partition UUID:     36033C28-202B-4932-B271-C8BD841FBAAF

   Disk Measurement:                 2.0 TB (2000796545024 Bytes) (precisely 3907805752 512-Byte-Items)
   System Block Measurement:         4096 Bytes

   Container Whole House:     2.0 TB (2000796545024 Bytes) (precisely 3907805752 512-Byte-Items)
   Container Free House:      1.2 TB (1209274347520 Bytes) (precisely 2361863960 512-Byte-Items)
   Allocation Block Measurement:     4096 Bytes

   Learn-Solely Media:           No
   Learn-Solely Quantity:          Sure

   System Location:           Inside
   Detachable Media:           Mounted

   Stable State:               Sure
   {Hardware} AES Assist:      Sure

   This disk is an APFS Quantity.  APFS Info:
   APFS Container:            disk1
   APFS Bodily Retailer:       disk0s2
   Fusion Drive:              No
   APFS Quantity Group:         8D013C64-D366-4902-B782-502203E919F2
   FileVault:                 Sure
   Locked:                    No

~/u/kh/bin> 

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments