Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 04-05-2012, 11:50 AM   #1
desepticon
Prospect
 
Join Date: Apr 2012
Posts: 4
Run Program With Screen At Startup

I've been trying to set up launchd to run rtorrent under screen at login with no success. Heres my plist from User LaunchAgents:

<?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>AbandonProcessGroup</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.rtorrent.start</string>
<key>ProgramArguments</key>
<array>
<string>screen -d -m rtorrent</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

I've tried running the program arguments as above, and also with each option as a separate string. I've also tried making the arguments a shell script. It never seems to run at login. Any help would be appreciated.

On a separate note, if I run to script manually after boot, it works, but I can't seem to be able to quit the program with the normal ^q command after I reattach the screen.

Running Mac OS X 10.7.3
desepticon is offline   Reply With Quote
Old 04-06-2012, 11:06 AM   #2
fracai
MVP
 
Join Date: May 2004
Posts: 2,094
Issues like this are almost always due to the PATH environment variable.

Try using full paths to each of your commands.

Also, keep in mind the user that is executing these commands. If this is executed as root, you may not be able to later join the screen session. And, rtorrent may end up looking at the wrong config file; you may want to pass in the path to your config file if rtorrent supports this. You can set the user and group with the UserName and GroupName keys.
fracai is offline   Reply With Quote
Old 04-11-2012, 06:29 PM   #3
desepticon
Prospect
 
Join Date: Apr 2012
Posts: 4
I can't seem to get this to work even when I spell out the paths completely. I was trying to use an AppleScript for a little while but I didn't like that it popped up in the GUI, however, briefly, when I logged in. I've been running the launchctl plist as an admin user (my account) with appropriate permissions on the files. I've set the User and Group keys and the AbandonProcessGroup key (which I thought I might need since rtorrent is a sub-process of screen). It's driving me nuts because I been able to accomplish quite a bit with launchctl lately but this one thing still eludes me.

Maybe as a StartupItem? But I would nee to run as root. Or maybe a loginhook? Is there something about screen that is preventing me from doing this?
desepticon is offline   Reply With Quote
Old 04-11-2012, 07:06 PM   #4
fracai
MVP
 
Join Date: May 2004
Posts: 2,094
Try specifying values for "StandardErrorPath" and "StandardOutPath". There may be error messages being lost in one of the system logs.

You could also increase verbosity for screen and rtorrent.
fracai is offline   Reply With Quote
Old 04-12-2012, 12:16 AM   #5
desepticon
Prospect
 
Join Date: Apr 2012
Posts: 4
For some reason it started working! I don't think I did anything different. Thanks for your help.

However, might you know why I can't seem to quit the program once I reattach the screen? I can kill it if I have to with a 'killall', but its really messy if you don't contact the tracker before you shutdown as it does when you quit within rtorrent.
desepticon is offline   Reply With Quote
Reply

Tags
launchd, rtorrent, screen

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:06 AM.


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.