Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Mac 10.4: Launchd Problem

Mac 10.4: Launchd Problem
Thread Tools
Pankaj
Fresh-Faced Recruit
Join Date: Feb 2008
Status: Offline
Reply With Quote
Feb 19, 2008, 03:55 AM
 
Hi,

I am trying to run more than one programs through single .plist using launchd.
I don't know how to put program arguments. I have tried for that but not getting results. I am new user of Mac 10.4

My .plist format is:

<?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>com.domain.Agent</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/prgram1</string>
<string>/usr/local/prgram2</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/Library/Logs/Prg.log</string>
<key>StandardOutPath</key>
<string>/Library/Logs/Prg.log</string>
</dict>
</plist>


Plz help on this..

Thanks,
Pankaj.
     
redJag
Senior User
Join Date: Dec 2002
Status: Offline
Reply With Quote
Feb 19, 2008, 04:26 PM
 
First let me say that I have no real knowledge of setting up launchd items but had to Google this a while back to get a CVS pserver running. Maybe this example will shine some light on your issue: AFP548 - CVS pserver launchd item for OS X 10.4

The first things I notice from glancing between yours and his is that you don't specify a Program or Username key/value. Also, might have to include the program name as the first child in the ProgramArguments array.

<?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>com.apple.cvspserver</string>
<key>UserName</key>
<string>cvs</string>
<key>Program</key>
<string>/usr/bin/cvs</string>
<key>ProgramArguments</key>
<array>
<string>cvs</string>
<string>-f</string>
<string>--allow-root=/Users/cvs</string>
<string>pserver</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockPassive</key>
<true/>
<key>SockServiceName</key>
<string>cvspserver</string>
<key>SockType</key>
<string>SOCK_STREAM</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
</dict>
</plist>
Travis Sanderson
     
numero
Junior Member
Join Date: Mar 2000
Location: Salem, OR, USA
Status: Offline
Reply With Quote
Feb 23, 2008, 03:10 PM
 
I wouldn't call myself an expert on this since I have only been poking around launchd a few days. I've been reading up on launchd this week for a project at work.

I don't think you can launch two executables with one plist. The way you have it now it will run as if the path to program2 is a parameter to program1.

It looks like you just want these programs to run at startup (or login, depending on which Library folder you put the plist in). I see two options.
1) Make a shell script that runs these two programs. Make the shell script the target of your plist.
2) Make two plists.

Let us know if you find a third option.

-numero
     
Pankaj  (op)
Fresh-Faced Recruit
Join Date: Feb 2008
Status: Offline
Reply With Quote
Feb 25, 2008, 02:38 AM
 
Thanks to u both for reply..
I am also trying for third option but not getting it.
Currently I solved it by making two .plist and one shell script.

Pankaj
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 11:29 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,