I have a Python program that writes to the /etc/hosts file. It works correctly manually entered using the sudo command. I want it to open automatically. I can load it into sudo launchctl but it returns PID - Status 1.
How do I fix this?
I have a Python program that writes to the /etc/hosts file. It works correctly manually entered using the sudo command. I want it to open automatically. I can load it into sudo launchctl but it returns PID - Status 1.
How do I fix this?
PID - Status 1 means that the process doesn't have enough privileges to access some files (presumably /etc/hosts). To be able to execute script as root, you need to move the loader to /Library/LaunchDaemons
or /System/Library/LaunchDaemons
(processes in /Library/LaunchAgents/
or ~/Library/LaunchAgents/
are run as current user so they don't have root rights).