I have a launchctl .plist file in /Library/LaunchDaemons as follows:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>david.ports.slocate.home.updatedb</string> <key>ProgramArguments</key> <array> <string>/opt/local/bin/slocate</string> <string>-U</string> <string>/Users/david</string> <string>-o</string> <string>/Users/david/slocate_david.db</string> </array> <key>Umask</key> <string>077</string> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>5</integer> <key>Minute</key> <integer>45</integer> </dict> </dict> </plist>
For those who are wondering, I use the slocate port from MacPorts instead of the native locate database that ships with OS X. This .plist job updates the slocate database specific to my home directory at 5:45 AM daily. The Umask setting of 077 makes the output file readable only by me. However, the file is created with the ownership of root; not what I want.
Is there a way to specify the ownership of the output file instead of the default of root? I realize I can run this as a LaunchAgent under ~/Library/LaunchAgents, but I prefer the job to run whether I am logged in or not, hence installing it as a LaunchDaemon.
I'm running OS X 10.10.3 Yosemite.