03-20-2020
7,
0
Join Date: Dec 2019
Last Activity: 20 May 2020, 12:16 PM EDT
Posts: 7
Thanks Given: 4
Thanked 0 Times in 0 Posts
Mac OS X Catalina - NFS File Access Behavior in CRON or Launchd
I'm really struggling here, and I think this is a new effect of upgrade to Catalina. I have an automounted NFS directory that contains a file I want to periodically copy to my Mac's local file system. I have a script that does this, and it worked beautifully before Catalina upgrade. If I run the script manually (as root) it's all good. If I run the script as part of a scheduled job it fails. I've tried launching the script in root owned cron job, and I've tried using Launchd. Both fail the same way.
My script:
#!/bin/sh
if [ -f /System/Volumes/Data/nfs/hosts ]
then
cat /etc/hosts.base /System/Volumes/Data/nfs/hosts > /etc/hosts
fi
/System/Volumes/Data/nfs is an NFS share coming off a Synology NAS.
The [ -f ...] part works fine. It can successfully determine if the hosts file exists in the NFS directory. But the cat command fails reading the hosts file. Again, if I run the script manually it all works fine. It only fails if the script is launched from cron or launchd.
File permissions:
brians-mbp:etc root# ls -la /System/Volumes/Data/nfs/hosts
-rwxrwxrwx 1 1024 _lpoperator 2393 Feb 8 14:29 /System/Volumes/Data/nfs/hosts
I've tried fiddling with owner and group, no effect. I've tried different approaches of mounting the NFS drive (automount, fstab, etc), no effect. I've tried different directories, different filenames, etc, no effect. I've tried using different shells in the script (sh, zsh, ...), no effect.
I've tried to find whether Catalina introduced some new ACL mechanisms but can't find anything other than gripes about how Apple changed directory structure in Catalina. But the fact that the script runs just fine if run manually tells me the permissions/ACLs must be ok.
Any ideas?
Brian