0

Ok, so I'm usually on stackoverflow, and I'm admittedly a little out of my element when it comes to more sys admin stuff.

I had an rsync script I wrote myself that functioned fine before I updated to catalina. Basically I wrote a bash script that would copy whitelisted hard drives to a NAS in the back of my building.

Since updating to Catalina

I get the following error rsync: failed to open log-file nas-log: Read-only file system (30)

So it sounds like a permissions error, but there are a few things I don't understand. The script is running from launchcontrol which is essentially launchctl? It's considered a 'global daemon' so I don't really know if its my user running this script, or root trying, and I don't know how to even see.

In order to get this script to work again, how do I fix the permissions to get avoid this error. I've already given Fill Disk Access to sh (as required in catalina's update)

And for reference here is what my bash script does

if [ -d /Volumes/Seville ]
then
  echo "Detected Seville... Beginning Rsync"
  rsync -az /Volumes/Seville rsync://[email protected]:873/rsync --log-file=nas-log --out-format="%t %f %b %n"
  echo "Rsync Complete ...Mailing Logs For Details"
  ruby /Users/$nasDir/Library/Scripts/mail.rb [email protected] Seville
  rm nas-log
fi
...#more drives

So it basically creates a log, emails it to the user and then deletes that log in order to keep it fresh the next time the script runs. I'm fine with this, I don't need to store these logs anywhere long term. Thank you in advance and I appreciate any help!

1 Answer 1

2

Catalina's system volume is mounted read-only (per [1]), your script was probably creating the file on a dir (on /?) which is now mounted read-only.

I'm not sure on which directory is Catalina running the rsync command (you could echo $PWD), but given that it is unable to create the nas-log file there the solution seems simple: use a full path. You could use /Users/$nasDir/nas-log, or /tmp/nas-log

2
  • I see. $pwd did indeed reveal "/", which I guess is where the scripts run from, even though thats not where the scripts are located. Is that just how launchctrl works? Or can you have the scripts run from a different spot and is there any reason PRE catalina that would make this matter? Thank you for the answer. This was helpful in my understanding.
    – Peege151
    Commented Sep 9, 2020 at 19:52
  • 1
    If you are running it as root, it would have worked when run as root. Creating a temporary file on / would be ugly, but it would have worked. Generally, if you want a program/script to run from its folder, it should cd there itself.
    – Ángel
    Commented Sep 10, 2020 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .