I’m trying to get launchd to run a script when the user logs in to their account. Been following other comments but can’t seem to get this to work. I’m doing this on OS 10.8.
This is my plist file created in text edit and saved as .plist (UTF-8)
Removing the StartCalendarInterval key didn’t make it work. I get nothing when I log in. I want to be able to mount shares when a user logs in.
Just to make sure I’m doing this correctly I put the plist file named com.myJob.agent.plist into my users’ LaunchAgents folder. then run command in terminal launchctl load -w /path/To/Plist.
What else should I need to do? How can I see where it’s hanging at?
According to the manual and my own plist which are working not:
You can leave program out, the first string in ProgramArguments will be used instead. At least it works on my machines (using Tiger, Leopard, Snow Leopard servers) when either one of them are left out
Changing the plist file to below seems to have worked for me… Now what should be done if I have a applescript saved as a stay open application? Removing the /usr/bin/osascript string doesn’t make the app run.
That is because when you’re in the world of BSD there is no such thing as an application, it’s just a directory. Inside an application there is an executable named applet. You need to start the application this way. So you can completely ignore osascript and launch the application immediately.