Launch Agent problem
Hello, I have a problem with a particular plist file that executes one of my scripts.
The script executes a named pipe over the command:
pmset -g pslog
in other to monitor the power source and its work perfectly if executed manually or with a cron job.
I am trying to use launchd to execute this script because I am migrating all my automatic script execution over this service.
The content of the net.minilan.ps_observer.plist file is the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>Author</key>
<string>PB</string>
<key>Description</key>
<string>Monitor power state and export over MQTT</string>
<key>Version</key>
<string>0.1</string>
<key>Label</key>
<string>net.minilan.ps_observer</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>~/Development/ps_observer.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>Crashed</key>
<true/>
</dict>
<key>ThrottleInterval</key>
<integer>10</integer>
</dict>
</plist>
This .plist file is located in ~/Library/LaunchAgents because I no need to execute this with other users or without login users, just with my user.
Then I have loaded it with:
launchctl load ~/Library/LaunchAgents/net.minilan.ps_observer.plist
Unfortunately, that plist file doesn't work.
The cronjob "equivalent" configuration (non exactly equivalent) is:
@reboot cd ~/Development && ./ps_observer.sh
Many thanks for any help.
Mac mini, macOS 10.13