![]() |
Login Hook, launchd, it just doesn't seem to want to work. :confused:
I'm trying to automatically start Folding@home on login. So far, the only way I've been able to do it is using an Applescript.app and login items. I need a way to execute this line in a Terminal window: /path/to/fah5 -local If I try to execute it from a shell script, it doesn't run. If that shell script is a login hook, it hangs the system! From Applescript I can tell the Terminal to open a new window and execute fah5 in it, but I'd prefer to get a login hook or launchd to work. Any ideas? - Oh, and this is in Tiger. |
I used Lingon to create this LaunchAgent:
Code:
<?xml version="1.0" encoding="UTF-8"?> |
Close! But it doesn't get the -local portion correct. This gets logged repeatedly in the Console:
Quote:
Yes, moving the app seems to work, but since it's no longer running in a Terminal window, I can't be sure. Anyone know of a way to redirect the output of a running process? It appears to be writing these files: /usr/lib/dyld /usr/lib/libSystem.B.dylib /dev/null /dev/console I'm assuming /dev/null would normally be the Terminal window. |
Isn't folding@home an application, or is it strictly a background process?
So, maybe use loginwindow manager with this simple shell script, of course this will be at log in not start up, so you would have to log in. Code:
#!/bin/bash |
Quote:
Code:
<key>StandardOutPath</key> |
Quote:
Quote:
|
Quote:
To fire up an "app" via launchd plist, here is another way (I use): Code:
|
Well, I thought it was working. :(
For some reason, FAH is failing in the middle of work units: I noticed this at the top of the output file: Ignoring argument: -local when I run it from the Terminal, I get: Using local directory for work files Here's a sample error: Code:
[18:39:32] Writing local files |
Quote:
Try writing a script that will launch FAH for you. and then just calling that script from launchd. Have the script export HOME as your users home directory. I know there are provisions for defining the home directory within a launchd plist, but I've not used them so I don't know if this will help. OTOH if you have the plist in ~/Library/LaunchAgents I've got no idea. Does FAH have any way to pass more info to it on launch (--path-to-workspace="")? p.s. do any of you have trouble hitting tab to auto-complete only to realize your in a text editor?...I do this all the time. |
The plist is in ~/Library/LaunchAgents. I tried to do this through a script, but I don't know of another way to run it from a Terminal window without using osacript, in which case I might as well call it from login items.
|
Quote:
|
Won't that cause it to run for each user that logs in? If I give it explicit paths in that case, they couldn't be in a user's home, but if they weren't, then I could end up with multiple instances working on the same data.
Maybe I'll try it between snow shoveling sessions tomorrow. :eek: |
well, the other alternative is to launch it from the root folder, but use the UserName key to make sure it always runs as a particular user (I'm assuming they have that key in Tiger, incidentally - I only have easy access to the Leopard man page). that might mean that you'd want create a separate user dedicated to doing whatever it is this app does...
I checked out the folding@home website, incidentally. you know, on the FAQ page they imply you can just add folding@home to your login items, and it will run just fine. see it here... did you try that way, and if so what was the problem? |
That's the graphical application. I'm using the command line console in this case so that it runs in the background while I use the system. I also run the screen saver, so that gives me two instances at a time. Since I've only got a dual processor system, that's all I want running.
|
Here's the Applescript I was using to start it. I saved it as a run only app and added it to login items, and it works well, except that I can't do anything until after the gui scripting completes. A login hook or launchd wouldn't need the gui portion and it would be quicker too.
Code:
tell application "Terminal" |
well, the Console version has the same instructions (here). my sense is, though, that this opens and runs the command in terminal. let me try downloading it myself and see what happens...
|
Quote:
|
Quote:
I actually wouldn't mind doing this myself, but man is it a CPU hog. does that settle down after a while? |
It's low priority, so it gets out of the way easily, but it will use as much of the cpu as is available. That's what I like about it. I can leave it running all the time, and it won't hog the processor when I need it. When I leave the computer, I start the screen saver, which keeps the other processor busy. That way my system is doing some good while I'm not using it.
|
cool. I will run it then. :)
|
| All times are GMT -5. The time now is 10:16 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.