My problem is very straight forward: I'm trying to run commands for every user that logs in through using a LaunchAgent that runs a bash script:
#!/bin/bash
#/usr/bin/testing.sh
mkdir -p /Users/myname/Created
/usr/local/bin/dockutil --add "/Users/myname/Networks"
sudo dockutil --add "/usr/bin"
sudo dockutil --add "/usr/"
sudo dockutil --list > /Users/myname/Desktop/test.txt
In /Library/LaunchAgents/com.myname.test.plist :
<?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>Label</key>
<string>com.sait.test.app</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>/usr/bin/testing.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/var/log/myjob.log</string>
<key>Debug</key>
<true/>
</dict>
</plist>
The folder is created on login. But, none of the DockUtil commands are executed. That is, my dock isn't changed and the test.txt doesn't contain any text. When I run these manually in the terminal, they work fine.
Why is this? Is there something that is wrong with how dock-util is loaded, or how it executes that I'm not aware of?
