Closed hidesminimally closed 8 years ago
I use outset to trigger dockutil
https://github.com/chilcote/outset
Sent from my iPhone
On Nov 3, 2015, at 12:58 PM, Daniel Li notifications@github.com wrote:
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?
— Reply to this email directly or view it on GitHub.
@lilshim, did you change the plist with chown in the terminal? Root / wheel
@mvught This means running sudo chown root /Library/LaunchAgents/com.myname.test.plist
right?
Sudo chown root:wheel com.myname.test.plist
@mvught yeah.. tried that... no difference.
You should not attempt to run as root within a Launch Agent in Aqua context. (Remove sudo)
In general it is best to not run dockutil as root. When run as the user it is more likely that cfprefs works properly.
Kyle
Sent from Mobile
On Nov 3, 2015, at 1:58 PM, Daniel Li notifications@github.com wrote:
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?
— Reply to this email directly or view it on GitHub.
Hello lilshim, did you have any progress with your test?
lilshim,
Can you try this below:
dockutil="/usr/local/bin/dockutil" mkdir -p /Users/myname/Created
$dockutil --add "/Users/myname/Networks" /bin/sleep 10 $dockutil --add "/usr/bin" /bin/sleep 10 $dockutil --add "/usr/" /bin/sleep 10 $dockutil --list > /Users/myname/Desktop/test.txt
Please test with latest version (2.0.3) or newer.
I'm going to close this. Please test with latest version.
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:
In /Library/LaunchAgents/com.myname.test.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?