# launchd scheduled launch of cocoa app



## Fragger (Aug 25, 2005)

I've been trying to get launchd to automatically launch and kill my bitTorrent Client, with no results. I have tried calling both shell scripts and the application itself from within a plist I know was successfully loaded with launchctl. Here is the current plist, which calls the client directly...

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>Bit Torrent</string>
	<key>LowPriorityIO</key>
	<true/>
	<key>Nice</key>
	<integer>1</integer>
	<key>ProgramArguments</key>
	<array>
		<string>/Applications/BitTorrent.app/Contents/MacOS/BitTorrent</string>
	</array>
	<key>StartCalendarInterval</key>
	<dict>
		<key>Hour</key>
		<integer>20</integer>
		<key>Minute</key>
		<integer>16</integer>
	</dict>
</dict>
</plist>
```
Please let me know if you see something wrong with my logic...

Graham


----------



## scruffy (Aug 25, 2005)

Well, that would be trying to start a GUI app, as root, even when there's no one logged on to the console.  You'd probably have a better shot at running the python scripts.

Other than that, if I'm not mistaken, it won't do you much good to start bittorrent without also opening a torrent, right?


----------



## Fragger (Aug 25, 2005)

I loaded the plist file into the launchctl daemon started by my user, not the instance running as root. I'm guessing the problem has something to do with whether the task is hidden/backgrounded.

Thanks for your suggestions though,
I will probably end up using cron, but wanted to give launchd a try since apple is forcing it upon us so.. forcefully...

maybe someone else has experience with this launchd thingy?a

thanks again,
graham


----------



## andehlu (Aug 26, 2005)

if youre using tiger you can try automator.....


----------



## th3joker (Mar 21, 2007)

I've been having similar problems with my news client. As it's an app you can use iCal to start it with the alarm function (launch app) and a simple applescript (tell app <appname> to quit) to stop it via iCal (launch script)


----------

