From levi at grokers.net Tue Mar 4 14:24:52 2008
From: levi at grokers.net (Levi Brown)
Date: Tue, 4 Mar 2008 15:24:52 -0700
Subject: [launchd-dev] Environment variable usage in LaunchAgents plist files
Message-ID: <5A2FD44F-0F16-476A-81D6-8BBB56B4AADA@grokers.net>
Hi All,
While trying to understand why my console had log entries every two
minutes such as this:
3/4/08 10:40:00 com.apple.launchd[1] (0x102450.cron[9834]) Could not
setup Mach task special port 9: (os/kern) no access
I decided that perhaps it was time to get rid of my cron jobs in favor
of launchd.plist entries. So I set out to convert my crontab entry:
*/2 * * * * /bin/sh "${HOME}/Library/Automation/checkmail.sh" > /dev/
null 2>&1
into a launchd.plist of equal functionality. I presently have:
Label
com.lab.checkmail
ProgramArguments
/bin/sh
/Users/labrown/Library/Automation/checkmail.sh
StartInterval
120
But I'm unsettled by needing to specify a hard-coded path to my
script. Notice, in my crontab entry I was able to access HOME, but
when I try that in the plist, it is taken literally (without
expanding) and causes obvious problems.
HOME is set appropriately, and I can verify that by issuing the
'export' command to launchctl.
How does one work around this issue?
Thanks,
Levi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080304/7b2eadaa/attachment.bin
From levi at grokers.net Tue Mar 4 14:36:38 2008
From: levi at grokers.net (Levi Brown)
Date: Tue, 4 Mar 2008 15:36:38 -0700
Subject: [launchd-dev] Documentation Suggestion
Message-ID: <2B4191E9-2DA7-45B2-949B-7A7132ACBCB5@grokers.net>
Hello all,
Reading the man entry for launchd.plist I read this:
StartInterval
This optional key causes the job to be started every N seconds.
If the
system is asleep, the job will be started the next time the
computer
wakes up. If multiple intervals transpire before the computer is
woken,
those events will be coalesced into one event upon wake from sleep.
Which, if I may suggest so, could be improved to be less ambiguous.
Specifically, this does not tell the reader if the job will be started
every N seconds, if it is already running or not. Through
experimentation I was able to discover that if the job is presently
running when the interval expires, no new job will be initiated, and
no queuing effect will occur either. This happens to be the behavior /
I/ wanted for my purposes, but the documentation is not clear on this
matter and there is no mention of a way to allow spawning of multiple
jobs should the intervals overlap, etc.
Also:
LimitLoadToSessionType
This configuration file only applies to sessions of the type
specified.
This key is used in concert with the -S flag to launchctl.
Again, through experimentation, I found that the presence of this key
would cause launchctl to "not find" the job described in the plist
unless the -S flag was specified, which one might consider implied by
the documentation, however there is no mention of the treatment of
jobs configured with this key on startup. Will it be loaded, or will
it be "not found" until some config is changed?
Thanks for listening,
Levi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080304/e75ac78a/attachment.bin
From gfranks at hwi.buffalo.edu Tue Mar 4 14:46:46 2008
From: gfranks at hwi.buffalo.edu (Geoff Franks)
Date: Tue, 04 Mar 2008 17:46:46 -0500
Subject: [launchd-dev] Documentation Suggestion
In-Reply-To: <2B4191E9-2DA7-45B2-949B-7A7132ACBCB5@grokers.net>
Message-ID:
On 3/4/08 5:36 PM, "Levi Brown" wrote:
> Hello all,
>
> Reading the man entry for launchd.plist I read this:
>
> StartInterval
> This optional key causes the job to be started every N seconds.
> If the
> system is asleep, the job will be started the next time the
> computer
> wakes up. If multiple intervals transpire before the computer is
> woken,
> those events will be coalesced into one event upon wake from sleep.
>
> Which, if I may suggest so, could be improved to be less ambiguous.
> Specifically, this does not tell the reader if the job will be started
> every N seconds, if it is already running or not. Through
> experimentation I was able to discover that if the job is presently
> running when the interval expires, no new job will be initiated, and
> no queuing effect will occur either. This happens to be the behavior /
> I/ wanted for my purposes, but the documentation is not clear on this
> matter and there is no mention of a way to allow spawning of multiple
> jobs should the intervals overlap, etc.
>
I second this. I was trying to find the answer to this and ended up testing
it myself, after scouring the net and list archives with no answers.
Geoff Franks
Sr. Systems Administrator
Hauptman Woodward Institute
From levi at grokers.net Tue Mar 4 14:53:42 2008
From: levi at grokers.net (Levi Brown)
Date: Tue, 4 Mar 2008 15:53:42 -0700
Subject: [launchd-dev] Directory Access launching?
Message-ID:
Hello all,
I have an interesting situation which I thought I might be able to
utilize launchd to help me solve, but I could use some expert advice.
The idea is pretty simple:
I use gnupg. gnupg is used by services I use. gnupg stores all its
information in ~/.gnupg unless the gnupg executable is called with a
flag to tell it to do otherwise. Since I do not have control of how
the executable is referenced by these services, the ~/.gnupg directory
is my only choice. Stored inside the ~/.gnupg directory is the public
and private keys for signing, en/decrypting, configuration, etc. which
is sensitive information and could easily be accessed should my
machine be stolen, for instance.
I'd like to store the contents of this directory on an encrypted disk
image which is automatically attached and detached based on need. So,
ideally, there would be a way to have a particular directory be
monitored for access, and once accessed, a script could be called to
mount the image. After a period of inactivity to this path, the
volume could be detached.
automount and autofs are intended to do this kind of operation for
network volumes an even provide a executable map facility which gives
one a hook into the need to mount a directory based on access, however
this is "old school" unix compared to the launchd train of thought,
and I've not been able to get a solution working with this approach.
Is there some configuration key like PathState, or NetworkState which
could be used to achieve this goal? Other suggestions?
Thanks,
Levi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080304/36bc01e0/attachment-0001.bin
From shawnce at gmail.com Tue Mar 4 14:55:26 2008
From: shawnce at gmail.com (Shawn Erickson)
Date: Tue, 4 Mar 2008 14:55:26 -0800
Subject: [launchd-dev] Documentation Suggestion
In-Reply-To: <2B4191E9-2DA7-45B2-949B-7A7132ACBCB5@grokers.net>
References: <2B4191E9-2DA7-45B2-949B-7A7132ACBCB5@grokers.net>
Message-ID:
On Tue, Mar 4, 2008 at 2:36 PM, Levi Brown wrote:
> Thanks for listening,
Report issues to Apple directly if you want to make sure the know about them.
Note the feedback block at the bottom of the following page...
...or report a bug...
-Shawn
From levi at grokers.net Tue Mar 4 15:03:49 2008
From: levi at grokers.net (Levi Brown)
Date: Tue, 4 Mar 2008 16:03:49 -0700
Subject: [launchd-dev] Documentation Suggestion
In-Reply-To:
References: <2B4191E9-2DA7-45B2-949B-7A7132ACBCB5@grokers.net>
Message-ID: <494FE298-A13D-4885-949A-B650741B84D6@grokers.net>
Hi Shawn,
That brings up an interesting point...
I'm subscribed to the macosforge launchd-dev list, as are you.
Wouldn't that imply bugs should be filed through macosforge?
http://trac.macosforge.org/projects/launchd/report
Levi
On Mar 4, 2008, at 15:55, Shawn Erickson wrote:
> On Tue, Mar 4, 2008 at 2:36 PM, Levi Brown wrote:
>
>> Thanks for listening,
>
> Report issues to Apple directly if you want to make sure the know
> about them.
>
>
> Note the feedback block at the bottom of the following page...
>
> >
>
> ...or report a bug...
>
>
>
> -Shawn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080304/b8e42097/attachment.bin
From levi at grokers.net Tue Mar 4 15:28:06 2008
From: levi at grokers.net (Levi Brown)
Date: Tue, 4 Mar 2008 16:28:06 -0700
Subject: [launchd-dev] Documentation Suggestion
In-Reply-To:
References:
Message-ID:
On Mar 4, 2008, at 15:46, Geoff Franks wrote:
> On 3/4/08 5:36 PM, "Levi Brown" wrote:
>
>> Hello all,
>>
>> Reading the man entry for launchd.plist I read this:
>>
>> StartInterval
>> This optional key causes the job to be started every N seconds.
>> If the
>> system is asleep, the job will be started the next time the
>> computer
>> wakes up. If multiple intervals transpire before the computer is
>> woken,
>> those events will be coalesced into one event upon wake from
>> sleep.
>>
>> Which, if I may suggest so, could be improved to be less ambiguous.
>> Specifically, this does not tell the reader if the job will be
>> started
>> every N seconds, if it is already running or not. Through
>> experimentation I was able to discover that if the job is presently
>> running when the interval expires, no new job will be initiated, and
>> no queuing effect will occur either. This happens to be the
>> behavior /
>> I/ wanted for my purposes, but the documentation is not clear on this
>> matter and there is no mention of a way to allow spawning of multiple
>> jobs should the intervals overlap, etc.
>>
>
> I second this. I was trying to find the answer to this and ended up
> testing
> it myself, after scouring the net and list archives with no answers.
>
> Geoff Franks
> Sr. Systems Administrator
> Hauptman Woodward Institute
Hi Geoff,
I've filed a ticket against this, if you'd like to comment within the
ticket system:
Ticket URL:
Cheers,
Levi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2415 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080304/3b578abf/attachment.bin
From macqaguy at gmail.com Tue Mar 11 13:41:12 2008
From: macqaguy at gmail.com (Mac QA)
Date: Tue, 11 Mar 2008 16:41:12 -0400
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
Message-ID: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
Hi,
I have a custom process that is invoked when a user logs in via having
a launchd config file located in /Library/Launch Agents. The config
file looks something like this:
KeepAlive
Label
com.company.mylaunchagent
OnDemand
ProgramArguments
/mylaunchagent
RunAtLoad
The mylaunchagent is invoked just fine. If I do a fast user switch to
login another user then a second instance is invoked for the second
user. All seems good. However, when the second user logs out the
second instance of mylaunchagent continues to stay running even though
the user logs out!
The Apple Multiple User Environments document [1] makes two statements
regarding this. First, "If a user process daemonizes itself prior to
logout, it can live past the end of the user logout and prolong the
existence of the login session." And Second, "Per-user services are
shut down automatically and are not given the chance to abort the
logout procedure." The mylaunchagent process is always a background
process just invoked by launchd, so given the first statement I guess
that is why it is persisting logout. However, given the second
statement, since this is a per-user service as launchagents are by
definition, I don't understand why it isn't shut down automatically on
logout. Frankly, those two statements seem contradictory.
[1] Apple Multiple User Environments
http://developer.apple.com/documentation/MacOSX/Conceptual/BPMultipleUsers/Concepts/SystemContexts.html#//apple_ref/doc/uid/20002208-106206
Can anyone point me towards how to make sure my launch agent processes
get properly killed when a user logs out? I appreciate any tips.
Thanks!
From hamish at gmail.com Tue Mar 11 13:55:08 2008
From: hamish at gmail.com (Hamish Allan)
Date: Tue, 11 Mar 2008 20:55:08 +0000
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
In-Reply-To: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
References: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
Message-ID: <597e7edb0803111355n763cfa4fhd74fc2bd6ce037c0@mail.gmail.com>
On Tue, Mar 11, 2008 at 8:41 PM, Mac QA wrote:
> The Apple Multiple User Environments document [1] makes two statements
> regarding this. First, "If a user process daemonizes itself prior to
> logout, it can live past the end of the user logout and prolong the
> existence of the login session." And Second, "Per-user services are
> shut down automatically and are not given the chance to abort the
> logout procedure." The mylaunchagent process is always a background
> process just invoked by launchd, so given the first statement I guess
> that is why it is persisting logout. However, given the second
> statement, since this is a per-user service as launchagents are by
> definition, I don't understand why it isn't shut down automatically on
> logout. Frankly, those two statements seem contradictory.
I take the second statement to mean "We send a SIGKILL to the agent".
If the agent has daemonized, the child will have been re-parented,
hence the first statement.
In short: the mylaunchagent process must not daemonize, i.e., must not
fork and exit. If it has a '-f' (run in foreground) option or similar,
use that.
Hamish
From zarzycki at apple.com Tue Mar 11 19:48:37 2008
From: zarzycki at apple.com (Dave Zarzycki)
Date: Tue, 11 Mar 2008 19:48:37 -0700
Subject: [launchd-dev] Environment variable usage in LaunchAgents plist
files
In-Reply-To: <5A2FD44F-0F16-476A-81D6-8BBB56B4AADA@grokers.net>
References: <5A2FD44F-0F16-476A-81D6-8BBB56B4AADA@grokers.net>
Message-ID: <529173DC-4E1A-4BCB-86B9-2460552049C5@apple.com>
Levi,
launchd does not depend on or otherwise require the machine to have a
shell. In fact, Apple's iPhone does not even have /bin/sh. If you want
to express environmental variables as command line arguments, please
consider having launchd run: /sbin/sh -c $HOME/something/something-
else.sh
davez
On Mar 4, 2008, at 2:24 PM, Levi Brown wrote:
> Hi All,
>
> While trying to understand why my console had log entries every two
> minutes such as this:
>
> 3/4/08 10:40:00 com.apple.launchd[1] (0x102450.cron[9834]) Could not
> setup Mach task special port 9: (os/kern) no access
>
> I decided that perhaps it was time to get rid of my cron jobs in
> favor of launchd.plist entries. So I set out to convert my crontab
> entry:
>
> */2 * * * * /bin/sh "${HOME}/Library/Automation/checkmail.sh" > /dev/
> null 2>&1
>
> into a launchd.plist of equal functionality. I presently have:
>
>
>
>
>
> Label
> com.lab.checkmail
> ProgramArguments
>
> /bin/sh
> /Users/labrown/Library/Automation/checkmail.sh
>
> StartInterval
> 120
>
>
>
> But I'm unsettled by needing to specify a hard-coded path to my
> script. Notice, in my crontab entry I was able to access HOME, but
> when I try that in the plist, it is taken literally (without
> expanding) and causes obvious problems.
>
> HOME is set appropriately, and I can verify that by issuing the
> 'export' command to launchctl.
>
> How does one work around this issue?
>
> Thanks,
>
> Levi_______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
From zarzycki at apple.com Tue Mar 11 19:58:30 2008
From: zarzycki at apple.com (Dave Zarzycki)
Date: Tue, 11 Mar 2008 19:58:30 -0700
Subject: [launchd-dev] Directory Access launching?
In-Reply-To:
References:
Message-ID: <9B29E4C7-11D0-414A-BE00-D8A39132CD8B@apple.com>
On Mar 4, 2008, at 2:53 PM, Levi Brown wrote:
> Hello all,
>
> I have an interesting situation which I thought I might be able to
> utilize launchd to help me solve, but I could use some expert advice.
>
> The idea is pretty simple:
>
> I use gnupg. gnupg is used by services I use. gnupg stores all its
> information in ~/.gnupg unless the gnupg executable is called with a
> flag to tell it to do otherwise. Since I do not have control of how
> the executable is referenced by these services, the ~/.gnupg
> directory is my only choice. Stored inside the ~/.gnupg directory
> is the public and private keys for signing, en/decrypting,
> configuration, etc. which is sensitive information and could easily
> be accessed should my machine be stolen, for instance.
>
> I'd like to store the contents of this directory on an encrypted
> disk image which is automatically attached and detached based on
> need. So, ideally, there would be a way to have a particular
> directory be monitored for access, and once accessed, a script could
> be called to mount the image. After a period of inactivity to this
> path, the volume could be detached.
>
> automount and autofs are intended to do this kind of operation for
> network volumes an even provide a executable map facility which
> gives one a hook into the need to mount a directory based on access,
> however this is "old school" unix compared to the launchd train of
> thought, and I've not been able to get a solution working with this
> approach.
>
> Is there some configuration key like PathState, or NetworkState
> which could be used to achieve this goal? Other suggestions?
Levi,
If I am following your thought process correctly, I do not believe
there is currently a mechanism with launchd that will let you
accomplish your goal. I'm also not sure this is the problem domain of
launchd. The primary design paradigm of launchd revolves around IPC
(be it Unix sockets or Mach ports). Secondarily, launchd supports
monitoring a few Unix subsystems for changes (path state and network
state are good examples). Neither of these two goals involve
interposing filesystem APi like autofs or automountd (like you gave as
examples).
You might want to try and find some contacts within Apple's filesystem
engineering community to accomplish your goal. I suspect that the
filesystem team will assert that the normal filesystem permission
model is good enough. If you are not satisfied, then I suspect that
they will assert that Apple's FileVault technology is appropriate.
Good luck,
davez
From zarzycki at apple.com Tue Mar 11 20:11:42 2008
From: zarzycki at apple.com (Dave Zarzycki)
Date: Tue, 11 Mar 2008 20:11:42 -0700
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
In-Reply-To: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
References: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
Message-ID: <11D22D58-099A-4D7D-8A22-9443DE719DE6@apple.com>
"Mac QA",
Does your agent catch Unix signals? Can you please do a "launchctl
list com.company.mylaunchagent" and email us the results?
Thanks!
davez
On Mar 11, 2008, at 1:41 PM, Mac QA wrote:
> Hi,
>
> I have a custom process that is invoked when a user logs in via having
> a launchd config file located in /Library/Launch Agents. The config
> file looks something like this:
>
> KeepAlive
>
> Label
> com.company.mylaunchagent
> OnDemand
>
> ProgramArguments
>
> /mylaunchagent
>
> RunAtLoad
>
>
> The mylaunchagent is invoked just fine. If I do a fast user switch to
> login another user then a second instance is invoked for the second
> user. All seems good. However, when the second user logs out the
> second instance of mylaunchagent continues to stay running even though
> the user logs out!
>
> The Apple Multiple User Environments document [1] makes two statements
> regarding this. First, "If a user process daemonizes itself prior to
> logout, it can live past the end of the user logout and prolong the
> existence of the login session." And Second, "Per-user services are
> shut down automatically and are not given the chance to abort the
> logout procedure." The mylaunchagent process is always a background
> process just invoked by launchd, so given the first statement I guess
> that is why it is persisting logout. However, given the second
> statement, since this is a per-user service as launchagents are by
> definition, I don't understand why it isn't shut down automatically on
> logout. Frankly, those two statements seem contradictory.
>
> [1] Apple Multiple User Environments
> http://developer.apple.com/documentation/MacOSX/Conceptual/BPMultipleUsers/Concepts/SystemContexts.html#/
> /apple_ref/doc/uid/20002208-106206
>
> Can anyone point me towards how to make sure my launch agent processes
> get properly killed when a user logs out? I appreciate any tips.
> Thanks!
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
From macqaguy at gmail.com Thu Mar 13 12:57:01 2008
From: macqaguy at gmail.com (Mac QA)
Date: Thu Mar 13 12:56:35 2008
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
In-Reply-To: <11D22D58-099A-4D7D-8A22-9443DE719DE6@apple.com>
References: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
<11D22D58-099A-4D7D-8A22-9443DE719DE6@apple.com>
Message-ID: <50fddc3d0803131257j7839d9d6g29dfd07cc1dda5f2@mail.gmail.com>
On Tue, Mar 11, 2008 at 4:55 PM, Hamish Allan wrote:
> In short: the mylaunchagent process must not daemonize, i.e., must not
> fork and exit. If it has a '-f' (run in foreground) option or similar,
> use that.
Hamish,
Thanks for the clarification. I think I understand the situation now.
The mylaunchagent process is a Cocoa tool that I wrote myself, and I
have no call to fork or exit in it. Yet it is meant to be a background
process invoked with launchd, so I guess that is the same thing.
On Tue, Mar 11, 2008 at 11:11 PM, Dave Zarzycki wrote:
> Does your agent catch Unix signals? Can you please do a "launchctl
> list com.company.mylaunchagent" and email us the results?
Dave,
No I don't catch Unix signals, my launch agent is written in Cocoa.
I've never been aquatinted with unix signals before. Shouldn't there
be a Cocoa notification to tell my lunch agent daemon that the user is
logging out to allowing me to clean-up and terminate the program? All
I can find is NSWorkspaceSessionDidResignActiveNotification, but this
is for if a fast user switch is performed not an actual logout.
In response to your inquiry about launchctl it only prints the name I
put in. So, I logged in 3 users via fast user switch, logded out two
of them, then Activity Monitor shows 3 instances of my launch agent
still running. And launchctl shows:
$ launchctl list com.company.mylaunchagentd
com.company.mylaunchagentd
Thank you both for your responses.
From macqaguy at gmail.com Thu Mar 13 13:03:11 2008
From: macqaguy at gmail.com (Mac QA)
Date: Thu Mar 13 13:02:48 2008
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
In-Reply-To: <11D22D58-099A-4D7D-8A22-9443DE719DE6@apple.com>
References: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
<11D22D58-099A-4D7D-8A22-9443DE719DE6@apple.com>
Message-ID: <50fddc3d0803131303j3eeef259w12bd395fc13c6257@mail.gmail.com>
On Tue, Mar 11, 2008 at 11:11 PM, Dave Zarzycki wrote:
> Does your agent catch Unix signals?
Quick clarifying question about this Unix signal business.
Currently, if I log in 3 users via fast user switching, log out two of
them, then Activity Monitor shows 3 instances of my launch agent
running. Yet even if I try to force quit one of the launch agents
running from one of the now logged out users from Activity Monitor
(and authenticate as an administrator to do so) the process still gets
re-launched by launchd. Doesn't it seem wrong for launchd to be
RE-launching an app for a user that is no longer logged in. If I do
whatever is necessary to catch this Unix signal business and exit the
daemon that way, will it still keep getting relaunched by launchd
after the user logs out?
From launchd at khiltd.com Thu Mar 13 13:32:07 2008
From: launchd at khiltd.com (Nathan Duran)
Date: Thu Mar 13 13:31:49 2008
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
In-Reply-To: <50fddc3d0803131303j3eeef259w12bd395fc13c6257@mail.gmail.com>
References: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
<11D22D58-099A-4D7D-8A22-9443DE719DE6@apple.com>
<50fddc3d0803131303j3eeef259w12bd395fc13c6257@mail.gmail.com>
Message-ID: <40573A92-FE0C-485F-9D57-3FC64D82C474@khiltd.com>
On Mar 13, 2008, at 1:03 PM, Mac QA wrote:
> Doesn't it seem wrong for launchd to be
> RE-launching an app for a user that is no longer logged in.
Fast User Switching does not log anybody out. That's why it's "fast."
From macqaguy at gmail.com Thu Mar 13 14:14:23 2008
From: macqaguy at gmail.com (Mac QA)
Date: Thu Mar 13 14:13:59 2008
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
In-Reply-To: <40573A92-FE0C-485F-9D57-3FC64D82C474@khiltd.com>
References: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
<11D22D58-099A-4D7D-8A22-9443DE719DE6@apple.com>
<50fddc3d0803131303j3eeef259w12bd395fc13c6257@mail.gmail.com>
<40573A92-FE0C-485F-9D57-3FC64D82C474@khiltd.com>
Message-ID: <50fddc3d0803131414x2a8cbf6eha5a66ca072ec9bad@mail.gmail.com>
On Thu, Mar 13, 2008 at 4:32 PM, Nathan Duran wrote:
> On Mar 13, 2008, at 1:03 PM, Mac QA wrote:
>
> > Doesn't it seem wrong for launchd to be
> > RE-launching an app for a user that is no longer logged in.
>
> Fast User Switching does not log anybody out. That's why it's "fast."
Right. The second and third users were logged in with fast user
switching. And then logged out by selecting logout from the Apple
menu. Leaving only one user logged in. Yet the launch agent processes
for users two and three were still running as viewed from the Activity
Monitor in user one. And when using the Activity Monitor to force quit
the launch agents from user two and three launchd automatically
relaunches them even though user two and three are no longer logged
in. I realize its MY fault that my launch agent doesn't get terminated
on logout, and that I need to respond to this Unix signal thing. But
it would also seem that there is a problem with launchd if it is
re-launching user agents for users that are not logged in to the
system.
From subscriber at gloaming.com Sun Mar 16 10:16:19 2008
From: subscriber at gloaming.com (James Bucanek)
Date: Sun Mar 16 10:15:45 2008
Subject: [launchd-dev] My Launch Agent is Persisting Beyond Logout
In-Reply-To: <50fddc3d0803111341o37e946d6v79aab36bb38f57aa@mail.gmail.com>
Message-ID:
Mac QA wrote (Tuesday, March 11,
2008 1:41 PM -0400):
>The mylaunchagent is invoked just fine. If I do a fast user switch to
>login another user then a second instance is invoked for the second
>user. All seems good. However, when the second user logs out the
>second instance of mylaunchagent continues to stay running even though
>the user logs out!
There are several levels of "logged in/out".
A launchd Aqua session is created when the user logs into the
GUI. When the user logs out again, the Aqua session ends.
Restrict your user agent to the Aqua session and it should
behave the way you are expecting.
LimitLoadToSessionType
Aqua
In contrast, the Background session for a user gets created
whenever a process for that user is created. This also gets
created when the user logs into the GUI but can just as easily
be created by starting a remote terminal session via ssh. The
Background session does not end when the user logs out of the GUI.
My product actually uses this fact to provide services for users
after they log out.
--
James Bucanek
From dmaclach at gmail.com Sun Mar 16 16:33:12 2008
From: dmaclach at gmail.com (Dave MacLachlan)
Date: Sun Mar 16 16:32:38 2008
Subject: [launchd-dev] launchd (257) not building
Message-ID: <69C22FE9-2AD8-47AB-B690-CB23451ED60F@gmail.com>
Hey Ryan...
> error: CoreFoundation/CFPriv.h: No such file or directory
I'm running into problems getting launchd to compile as well, but at
least for this part you can grab these headers from
http://src.macosforge.org/Roots/9C31/CF.root.tar.gz
Hope that helps somewhat. I'm still looking for
bootfiles.h
Cheers,
Dave
From dmaclach at google.com Sun Mar 16 18:00:33 2008
From: dmaclach at google.com (Dave MacLachlan)
Date: Sun Mar 16 18:48:26 2008
Subject: [launchd-dev] launchd (257) not building
Message-ID:
> Hey Ryan...
>> error: CoreFoundation/CFPriv.h:
> No such file or directory I'm running into problems getting launchd
> to compile as well, but at least for this part you can grab these
> headers from
> http://src.macosforge.org/Roots/9C31/CF.root.tar.gz Hope that helps
> somewhat. I'm still looking for
> bootfiles.h
Further follow up,
I haven't found bootfiles.h, but from what I can glean:
#define kBootRootActiveKey "bootroot-active"
#define SO_EXECPATH 0x1085
(could somebody please correct me if those values are wrong) but I
can't find quarantine.h anywhere, and radar is currently down so I
can't log a bug against it.
I'm trying to build up liblaunch, so I can build up a debug version of
libSystem so I can verify what appears to be a bug in libc_debug which
is occurring when I run my app against the _debug frameworks that DTS
is shipping. Talk about yak shaving.
Cheers,
Dave
From dmaclach at gmail.com Sun Mar 16 21:52:15 2008
From: dmaclach at gmail.com (Dave MacLachlan)
Date: Sun Mar 16 21:51:43 2008
Subject: [launchd-dev] launchd (257) not building
In-Reply-To:
References:
Message-ID:
On Mar 16, 2008, at 18:00 , Dave MacLachlan wrote:
>> Hey Ryan...
>>> error: CoreFoundation/CFPriv.h:
>> No such file or directory I'm running into problems getting launchd
>> to compile as well, but at least for this part you can grab these
>> headers from
>> http://src.macosforge.org/Roots/9C31/CF.root.tar.gz Hope that helps
>> somewhat. I'm still looking for
>> bootfiles.h
>
> Further follow up,
>
> I haven't found bootfiles.h, but from what I can glean:
>
> #define kBootRootActiveKey "bootroot-active"
> #define SO_EXECPATH 0x1085
>
> (could somebody please correct me if those values are wrong) but I
> can't find quarantine.h anywhere, and radar is currently down so I
> can't log a bug against it.
>
> I'm trying to build up liblaunch, so I can build up a debug version
> of libSystem so I can verify what appears to be a bug in libc_debug
> which is occurring when I run my app against the _debug frameworks
> that DTS is shipping. Talk about yak shaving.
Logged as radar 5802196: Unable to build TOT launchd from macosforge.org
Cheers,
Dave
From eskimo1 at apple.com Mon Mar 17 02:55:08 2008
From: eskimo1 at apple.com (Quinn)
Date: Mon Mar 17 03:05:37 2008
Subject: [launchd-dev] launchd (257) not building
In-Reply-To:
References:
Message-ID:
At 18:00 -0700 16/3/08, Dave MacLachlan wrote:
>I haven't found bootfiles.h, but from what I can glean:
>
>#define kBootRootActiveKey "bootroot-active"
>#define SO_EXECPATH 0x1085
>
>(could somebody please correct me if those values are wrong)
kBootRootActiveKey is defined in "bootfiles", which is open source.
SO_EXECPATH is part of the kernel source.
"quarantine.h" is part of the "quarantine" project, which is not open
source AFAIK.
S+E
--
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
From dmaclach at gmail.com Mon Mar 17 09:40:39 2008
From: dmaclach at gmail.com (Dave MacLachlan)
Date: Mon Mar 17 09:40:07 2008
Subject: [launchd-dev] launchd (257) not building
In-Reply-To:
References:
Message-ID:
On Mar 17, 2008, at 02:55 , Quinn wrote:
> At 18:00 -0700 16/3/08, Dave MacLachlan wrote:
>> I haven't found bootfiles.h, but from what I can glean:
>>
>> #define kBootRootActiveKey "bootroot-active"
>> #define SO_EXECPATH 0x1085
>>
>> (could somebody please correct me if those values are wrong)
>
> kBootRootActiveKey is defined in "bootfiles", which is open source.
>
> >
>
> SO_EXECPATH is part of the kernel source.
>
> >
>
> "quarantine.h" is part of the "quarantine" project, which is not
> open source AFAIK.
Thanks Quinn,
I will log a bug against darwinbuild to get IOKitUser added to the
dependencies for launchd. I also found the launchd "HAVE_QUARANTINE"
define, and turned that off. This allowed me to build liblaunch which
is what I needed. Unfortunately to build libSystem (my end goal) I
need to have libQuarantine, and libSandbox, both of which I am
guessing are not opensource at this time.
Logged radars
5802544: launchd doesn't compile with HAVE_QUARANTINE undefined
5802557: launchd makefiles need a better way of determining if
quarantine.h is available
and DarwinBuild bugs
http://trac.macosforge.org/projects/darwinbuild/ticket/9 launchd
depends on CoreFoundation
http://trac.macosforge.org/projects/darwinbuild/ticket/10 Libsystem
not building
Cheers,
Dave
From dmaclach at gmail.com Mon Mar 17 09:53:36 2008
From: dmaclach at gmail.com (Dave MacLachlan)
Date: Mon Mar 17 09:53:06 2008
Subject: [launchd-dev] Lowering the bar to entry
Message-ID: <79739CE4-408B-43A0-928E-99E8014F30C0@gmail.com>
Hey guys,
Would it be possible to add an intro page similar to the one for
DarwinBuild
http://trac.macosforge.org/projects/darwinbuild/
That shows quickly:
a) how to find the mailing list
b) how to download the source
c) and a readme describing how to build? specifically how to build the
libraries vs all of launchd?
There is a blog entry that covers some of this:
http://launchd.macosforge.org/?p=2
but it isn't extra easy to find.
Cheers,
Dave
From kvv at apple.com Mon Mar 17 11:08:44 2008
From: kvv at apple.com (Kevin Van Vechten)
Date: Mon Mar 17 11:09:32 2008
Subject: [launchd-dev] launchd (257) not building
In-Reply-To:
References:
Message-ID:
Please use DarwinBuild when building launchd. It takes care of dependencies
such as the missing headers below (though the quarantine issue is
separate).
Problems building launchd outside of DarwinBuild probably won't
receive much attention, since the issue is likely with the build
environment, not launchd itself.
- Kevin
On Mar 17, 2008, at 9:40 AM, Dave MacLachlan wrote:
>
> On Mar 17, 2008, at 02:55 , Quinn wrote:
>
>> At 18:00 -0700 16/3/08, Dave MacLachlan wrote:
>>> I haven't found bootfiles.h, but from what I can glean:
>>>
>>> #define kBootRootActiveKey "bootroot-active"
>>> #define SO_EXECPATH 0x1085
>>>
>>> (could somebody please correct me if those values are wrong)
>>
>> kBootRootActiveKey is defined in "bootfiles", which is open source.
>>
>> > >
>>
>> SO_EXECPATH is part of the kernel source.
>>
>> > >
>>
>> "quarantine.h" is part of the "quarantine" project, which is not
>> open source AFAIK.
>
> Thanks Quinn,
>
> I will log a bug against darwinbuild to get IOKitUser added to the
> dependencies for launchd. I also found the launchd "HAVE_QUARANTINE"
> define, and turned that off. This allowed me to build liblaunch
> which is what I needed. Unfortunately to build libSystem (my end
> goal) I need to have libQuarantine, and libSandbox, both of which I
> am guessing are not opensource at this time.
>
> Logged radars
> 5802544: launchd doesn't compile with HAVE_QUARANTINE undefined
> 5802557: launchd makefiles need a better way of determining if
> quarantine.h is available
>
> and DarwinBuild bugs
> http://trac.macosforge.org/projects/darwinbuild/ticket/9 launchd
> depends on CoreFoundation
> http://trac.macosforge.org/projects/darwinbuild/ticket/10 Libsystem
> not building
>
> Cheers,
> Dave
> _______________________________________________
> launchd-dev mailing list
> launchd-dev@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/launchd-dev
From dmaclach at gmail.com Mon Mar 17 11:24:05 2008
From: dmaclach at gmail.com (Dave MacLachlan)
Date: Mon Mar 17 11:23:37 2008
Subject: [launchd-dev] launchd (257) not building
In-Reply-To:
References:
Message-ID: <4220247E-4364-46D4-A106-8F31CF9E7925@gmail.com>
Hey Kevin,
I did use DarwinBuild and logged an issue on it:
>> http://trac.macosforge.org/projects/darwinbuild/ticket/9 launchd
>> depends on CoreFoundation
I was very busy logging DarwinBuild tickets this weekend ;-)
Cheers,
Dave
On Mar 17, 2008, at 11:08 , Kevin Van Vechten wrote:
> Please use DarwinBuild > when building launchd. It takes care of dependencies such as the
> missing headers below (though the quarantine issue is separate).
>
> Problems building launchd outside of DarwinBuild probably won't
> receive much attention, since the issue is likely with the build
> environment, not launchd itself.
>
> - Kevin
>
> On Mar 17, 2008, at 9:40 AM, Dave MacLachlan wrote:
>
>>
>> On Mar 17, 2008, at 02:55 , Quinn wrote:
>>
>>> At 18:00 -0700 16/3/08, Dave MacLachlan wrote:
>>>> I haven't found bootfiles.h, but from what I can glean:
>>>>
>>>> #define kBootRootActiveKey "bootroot-active"
>>>> #define SO_EXECPATH 0x1085
>>>>
>>>> (could somebody please correct me if those values are wrong)
>>>
>>> kBootRootActiveKey is defined in "bootfiles", which is open source.
>>>
>>> >> >
>>>
>>> SO_EXECPATH is part of the kernel source.
>>>
>>> >> >
>>>
>>> "quarantine.h" is part of the "quarantine" project, which is not
>>> open source AFAIK.
>>
>> Thanks Quinn,
>>
>> I will log a bug against darwinbuild to get IOKitUser added to the
>> dependencies for launchd. I also found the launchd
>> "HAVE_QUARANTINE" define, and turned that off. This allowed me to
>> build liblaunch which is what I needed. Unfortunately to build
>> libSystem (my end goal) I need to have libQuarantine, and
>> libSandbox, both of which I am guessing are not opensource at this
>> time.
>>
>> Logged radars
>> 5802544: launchd doesn't compile with HAVE_QUARANTINE undefined
>> 5802557: launchd makefiles need a better way of determining if
>> quarantine.h is available
>>
>> and DarwinBuild bugs
>> http://trac.macosforge.org/projects/darwinbuild/ticket/9 launchd
>> depends on CoreFoundation
>> http://trac.macosforge.org/projects/darwinbuild/ticket/10 Libsystem
>> not building
>>
>> Cheers,
>> Dave
>> _______________________________________________
>> launchd-dev mailing list
>> launchd-dev@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo/launchd-dev
>
From kvv at apple.com Mon Mar 17 12:33:59 2008
From: kvv at apple.com (Kevin Van Vechten)
Date: Mon Mar 17 12:34:51 2008
Subject: [launchd-dev] launchd (257) not building
In-Reply-To: <4220247E-4364-46D4-A106-8F31CF9E7925@gmail.com>
References:
<4220247E-4364-46D4-A106-8F31CF9E7925@gmail.com>
Message-ID: <62B1A822-5423-4892-92AE-76B44A1B5A04@apple.com>
Excellent. It wasn't clear from the context of this thread, and I
hadn't yet read darwinbuild-dev, but I now see that you were using
DarwinBuild.
Thanks for filing the tickets!
- Kevin
On Mar 17, 2008, at 11:24 AM, Dave MacLachlan wrote:
> Hey Kevin,
>
> I did use DarwinBuild and logged an issue on it:
>
>>> http://trac.macosforge.org/projects/darwinbuild/ticket/9 launchd
>>> depends on CoreFoundation
>
> I was very busy logging DarwinBuild tickets this weekend ;-)
>
> Cheers,
> Dave
>
> On Mar 17, 2008, at 11:08 , Kevin Van Vechten wrote:
>
>> Please use DarwinBuild > > when building launchd. It takes care of dependencies such as the
>> missing headers below (though the quarantine issue is separate).
>>
>> Problems building launchd outside of DarwinBuild probably won't
>> receive much attention, since the issue is likely with the build
>> environment, not launchd itself.
>>
>> - Kevin
>>
>> On Mar 17, 2008, at 9:40 AM, Dave MacLachlan wrote:
>>
>>>
>>> On Mar 17, 2008, at 02:55 , Quinn wrote:
>>>
>>>> At 18:00 -0700 16/3/08, Dave MacLachlan wrote:
>>>>> I haven't found bootfiles.h, but from what I can glean:
>>>>>
>>>>> #define kBootRootActiveKey "bootroot-active"
>>>>> #define SO_EXECPATH 0x1085
>>>>>
>>>>> (could somebody please correct me if those values are wrong)
>>>>
>>>> kBootRootActiveKey is defined in "bootfiles", which is open source.
>>>>
>>>> >>> >
>>>>
>>>> SO_EXECPATH is part of the kernel source.
>>>>
>>>> >>> >
>>>>
>>>> "quarantine.h" is part of the "quarantine" project, which is not
>>>> open source AFAIK.
>>>
>>> Thanks Quinn,
>>>
>>> I will log a bug against darwinbuild to get IOKitUser added to the
>>> dependencies for launchd. I also found the launchd
>>> "HAVE_QUARANTINE" define, and turned that off. This allowed me to
>>> build liblaunch which is what I needed. Unfortunately to build
>>> libSystem (my end goal) I need to have libQuarantine, and
>>> libSandbox, both of which I am guessing are not opensource at this
>>> time.
>>>
>>> Logged radars
>>> 5802544: launchd doesn't compile with HAVE_QUARANTINE undefined
>>> 5802557: launchd makefiles need a better way of determining if
>>> quarantine.h is available
>>>
>>> and DarwinBuild bugs
>>> http://trac.macosforge.org/projects/darwinbuild/ticket/9 launchd
>>> depends on CoreFoundation
>>> http://trac.macosforge.org/projects/darwinbuild/ticket/10
>>> Libsystem not building
>>>
>>> Cheers,
>>> Dave
>>> _______________________________________________
>>> launchd-dev mailing list
>>> launchd-dev@lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo/launchd-dev
>>
>
From rspaulding at arc.nasa.gov Mon Mar 17 14:38:05 2008
From: rspaulding at arc.nasa.gov (Ryan C. Spaulding)
Date: Mon Mar 17 14:55:16 2008
Subject: [launchd-dev] launchd (257) not building
In-Reply-To:
References:
Message-ID: <3E548C37-C1A7-4F39-8FA5-3DBCF4AF5778@arc.nasa.gov>
Hi Kevin,
Thank you for the tip, I did build mine outside of DarwinBuild.
Thank you,
Ryan
PS - Thank you for the response !
On Mar 17, 2008, at 11:08 AM, Kevin Van Vechten wrote:
> Please use DarwinBuild darwinbuild/> when building launchd. It takes care of dependencies
> such as the missing headers below (though the quarantine issue is
> separate).
>
> Problems building launchd outside of DarwinBuild probably won't
> receive much attention, since the issue is likely with the build
> environment, not launchd itself.
>
> - Kevin
>
> On Mar 17, 2008, at 9:40 AM, Dave MacLachlan wrote:
>
>>
>> On Mar 17, 2008, at 02:55 , Quinn wrote:
>>
>>> At 18:00 -0700 16/3/08, Dave MacLachlan wrote:
>>>> I haven't found bootfiles.h, but from what I can glean:
>>>>
>>>> #define kBootRootActiveKey "bootroot-active"
>>>> #define SO_EXECPATH 0x1085
>>>>
>>>> (could somebody please correct me if those values are wrong)
>>>
>>> kBootRootActiveKey is defined in "bootfiles", which is open source.
>>>
>>> >> kext.subproj/bootfiles.h>
>>>
>>> SO_EXECPATH is part of the kernel source.
>>>
>>> >> sys/socket.h>
>>>
>>> "quarantine.h" is part of the "quarantine" project, which is not
>>> open source AFAIK.
>>
>> Thanks Quinn,
>>
>> I will log a bug against darwinbuild to get IOKitUser added to the
>> dependencies for launchd. I also found the launchd
>> "HAVE_QUARANTINE" define, and turned that off. This allowed me to
>> build liblaunch which is what I needed. Unfortunately to build
>> libSystem (my end goal) I need to have libQuarantine, and
>> libSandbox, both of which I am guessing are not opensource at this
>> time.
>>
>> Logged radars
>> 5802544: launchd doesn't compile with HAVE_QUARANTINE undefined
>> 5802557: launchd makefiles need a better way of determining if
>> quarantine.h is available
>>
>> and DarwinBuild bugs
>> http://trac.macosforge.org/projects/darwinbuild/ticket/9 launchd
>> depends on CoreFoundation
>> http://trac.macosforge.org/projects/darwinbuild/ticket/10
>> Libsystem not building
>>
>> Cheers,
>> Dave
>> _______________________________________________
>> launchd-dev mailing list
>> launchd-dev@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo/launchd-dev
>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/launchd-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080317/43b5caa1/attachment.html
From mike_fischer at mac.com Mon Mar 17 15:23:13 2008
From: mike_fischer at mac.com (Mike Fischer)
Date: Mon Mar 17 15:43:10 2008
Subject: [launchd-dev] OnDemand USB Software
Message-ID: <79305EFD-C4A3-4979-85FD-2EC365A7947A@mac.com>
Hi!
I'm trying to evaluate if it is feasable to have an on-demand daemon
depend on the presence of a certain usb device. I.e. I'd like the
daemon to launch when the USB-device is plugged in.
So far, looking at tn2083 and the man pages, I don't see any way to
have a depency on USB or IOKit in general. Am I missing something here?
If there is no direct support would it make sense to have a very
small, lightweight daemon always running that registers for IOKit
IOServiceAddMatchingNotification notifications and creates a
semaphore file that can be used to trigger the launch of the real
daemon for example?
BTW: This would be mainly for Leopard, although Tiger would be
interesting too.
Thanks!
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Web:
Note: I read this list in digest mode!
Send me a private copy for faster responses.
From eskimo1 at apple.com Tue Mar 18 03:09:06 2008
From: eskimo1 at apple.com (Quinn)
Date: Tue, 18 Mar 2008 10:09:06 +0000
Subject: [launchd-dev] OnDemand USB Software
In-Reply-To: <79305EFD-C4A3-4979-85FD-2EC365A7947A@mac.com>
References: <79305EFD-C4A3-4979-85FD-2EC365A7947A@mac.com>
Message-ID:
At 23:23 +0100 17/3/08, Mike Fischer wrote:
>So far, looking at tn2083 and the man pages, I don't see any way to
>have a depency on USB or IOKit in general. Am I missing something
>here?
No, you're not missing something. This is a much-requested feature
that we're tracking as .
>If there is no direct support would it make sense to have a very
>small, lightweight daemon always running that registers for IOKit
>IOServiceAddMatchingNotification notifications and creates a
>semaphore file that can be used to trigger the launch of the real
>daemon for example?
That's a fine way to do it. I probably wouldn't use a semaphore
file, because it persists in the file system. However, there are
numerous other options available to you. If I was doing this, I'd
probably have your main daemon register a UNIX domain socket and have
your lightweight daemon connect to that socket to trigger a launch.
>BTW: This would be mainly for Leopard, although Tiger would be
>interesting too.
This approach would work just fine on 10.4.x (x >= 6 if you use UNIX
domain sockets).
S+E
--
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
From eskimo1 at apple.com Tue Mar 18 06:47:06 2008
From: eskimo1 at apple.com (Quinn)
Date: Tue, 18 Mar 2008 13:47:06 +0000
Subject: [launchd-dev] Stray Proccess Log message
In-Reply-To:
References:
Message-ID:
At 11:42 -0500 22/2/08, Geoff Franks wrote:
>/usr/sbin/raidutil list status | /usr/bin/mail -s "RAID: `hostname`"
>
>
>Is all I'm calling. I've had reports of a few other people on the
>MacEnterprise list with similar issues regarding postfix/sendmail and
>launchd jobs. Should I file a bug report for this?
Geoff, did you ever file a bug about this? I got asked about this on
another mailing list and I pretty much worked out what's going on
(see below). If you did file a bug, I'd like to add some info to the
bug. I looked, and couldn't find it.
The following is in the context of , but the
basics should also apply to your situation.
>1. launchd starts the "periodic" script
>
>2. In this config, "periodic" runs to deliver the report
>
>3. "mail" ends up invoking to do the real work
>
>4. "mail" does not /wait/ for "sendmail" to complete
>
>5. "mail" quits
>
>6. "periodic" quits
>
>7. launchd cleans up the job
>
>If "sendmail" has not quit at this point, launchd garbage collects
>it and you get this message (and no mail).
>
>One potential workaround is to set the "verbose" environment
>variable. This causes "mail" to wait for the "sendmail" to
>terminate before it quits. I'm not sure how that would play in the
>context of "periodic".
S+E
--
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
From chris.cleeland at gmail.com Thu Mar 27 04:53:54 2008
From: chris.cleeland at gmail.com (Chris Cleeland)
Date: Thu, 27 Mar 2008 06:53:54 -0500
Subject: [launchd-dev] Obtaining the value of SSH_AUTH_SOCK in an entry?
Message-ID: <5a4d1dc0803270453k1aa87b9cod91e891829571cd2@mail.gmail.com>
Hi,
I'm trying to set up an entry for launchd that will fire off ssh
on-demand to create a tunnel. I would like for the ssh to get
authentication information from ssh-agent, but I'm not sure if launchd
children inherit SSH_AUTH_SOCK in the environment, or if I somehow
have to designate that it gets it.
In the pre-leopard days when I used SSHKeyChain.app, the SSH_AUTH_SOCK
value was constant, and I could just set SSH_AUTH_SOCK in an
declaration in the entry.
Thanks,
-cj
From zarzycki at apple.com Thu Mar 27 08:12:03 2008
From: zarzycki at apple.com (Dave Zarzycki)
Date: Thu, 27 Mar 2008 08:12:03 -0700
Subject: [launchd-dev] Obtaining the value of SSH_AUTH_SOCK in an entry?
In-Reply-To: <5a4d1dc0803270453k1aa87b9cod91e891829571cd2@mail.gmail.com>
References: <5a4d1dc0803270453k1aa87b9cod91e891829571cd2@mail.gmail.com>
Message-ID:
Chris,
Mac OS X Leopard, as shipped, automatically manages 'ssh-agent' and
the corresponding environmental variable. One can verify this like so:
$ env | grep SSH_AUTH
SSH_AUTH_SOCK=/tmp/launch-01KBeh/Listeners
$
?and by reviewing /System/Library/LaunchAgents/org.openbsd.ssh-
agent.plist. You can also verify which processes have inherited the
SSH_AUTH_SOCK variable with:
ps axe
davez
On Mar 27, 2008, at 4:53 AM, Chris Cleeland wrote:
> Hi,
>
> I'm trying to set up an entry for launchd that will fire off ssh
> on-demand to create a tunnel. I would like for the ssh to get
> authentication information from ssh-agent, but I'm not sure if launchd
> children inherit SSH_AUTH_SOCK in the environment, or if I somehow
> have to designate that it gets it.
>
> In the pre-leopard days when I used SSHKeyChain.app, the SSH_AUTH_SOCK
> value was constant, and I could just set SSH_AUTH_SOCK in an
> declaration in the entry.
>
> Thanks,
> -cj
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
From chris.cleeland at gmail.com Thu Mar 27 08:31:41 2008
From: chris.cleeland at gmail.com (Chris Cleeland)
Date: Thu, 27 Mar 2008 10:31:41 -0500
Subject: [launchd-dev] Obtaining the value of SSH_AUTH_SOCK in an entry?
In-Reply-To:
References: <5a4d1dc0803270453k1aa87b9cod91e891829571cd2@mail.gmail.com>
Message-ID: <5a4d1dc0803270831y53f9b338i9156c2f3c34c85ee@mail.gmail.com>
Dave,
Thanks for the quick reply!
On Thu, Mar 27, 2008 at 10:12 AM, Dave Zarzycki wrote:
> Mac OS X Leopard, as shipped, automatically manages 'ssh-agent' and
> the corresponding environmental variable. One can verify this like so:
>
> $ env | grep SSH_AUTH
> SSH_AUTH_SOCK=/tmp/launch-01KBeh/Listeners
> $
Right. I like that!
> ?and by reviewing /System/Library/LaunchAgents/org.openbsd.ssh-
> agent.plist. You can also verify which processes have inherited the
> SSH_AUTH_SOCK variable with:
>
> ps axe
Mmmm...okay.
According to empirical evidence, though, the ssh spawned by launchd
isn't inheriting SSH_AUTH_SOCK
8298 ?? Ss 0:00.00 /usr/libexec/launchproxy /usr/bin/ssh -v -nNT -i /Use
rs/taoadmin/.ssh/svn.ociweb.com -L 22000:svn.ociweb.com:22 -l cleeland ssh.ociwe
b.com PATH=/usr/bin:/bin:/usr/sbin:/sbin __LAUNCHD_FD=47 TMPDIR=/var/folders/Z+/
Z+cmZ48wHRWaiAQNuFalnk+++TI/-Tmp-/ SHELL=/bin/bash HOME=/Users/taoadmin USER=tao
admin LOGNAME=taoadmin
8299 ?? S 0:00.02 /usr/bin/ssh -v -nNT -i /Users/taoadmin/.ssh/svn.ociw
eb.com -L 22000:svn.ociweb.com:22 -l cleeland ssh.ociweb.com PATH=/usr/bin:/bin:
/usr/sbin:/sbin TMPDIR=/var/folders/Z+/Z+cmZ48wHRWaiAQNuFalnk+++TI/-Tmp-/ SHELL=
/bin/bash HOME=/Users/taoadmin USER=taoadmin LOGNAME=taoadmin __CF_USER_TEXT_ENC
ODING=0x1F5:0:0
Is there a way I can tell it that I want SSH_AUTH_SOCK to be inherited?
-cj
From hamish at gmail.com Thu Mar 27 12:13:31 2008
From: hamish at gmail.com (Hamish Allan)
Date: Thu, 27 Mar 2008 19:13:31 +0000
Subject: [launchd-dev] Obtaining the value of SSH_AUTH_SOCK in an entry?
In-Reply-To: <5a4d1dc0803270831y53f9b338i9156c2f3c34c85ee@mail.gmail.com>
References: <5a4d1dc0803270453k1aa87b9cod91e891829571cd2@mail.gmail.com>
<5a4d1dc0803270831y53f9b338i9156c2f3c34c85ee@mail.gmail.com>
Message-ID: <597e7edb0803271213s274be53alfb1990f7d59d26e1@mail.gmail.com>
On Thu, Mar 27, 2008 at 3:31 PM, Chris Cleeland
wrote:
> According to empirical evidence, though, the ssh spawned by launchd
> isn't inheriting SSH_AUTH_SOCK
The answer to this question is in the archives... I know because I was
the one that asked it!
Your launchd agent must run in the Aqua context, which it should if
it's installed in [~]/Library/LaunchAgents, or if you supply '-S Aqua'
as an argument to launchctl.
Best wishes,
Hamish
From mike_fischer at mac.com Sat Mar 29 14:02:18 2008
From: mike_fischer at mac.com (Mike Fischer)
Date: Sat Mar 29 14:01:33 2008
Subject: [launchd-dev] OnDemand USB Software
In-Reply-To:
References:
Message-ID: <37787CBB-7740-46D0-AAF8-4B2D05BC53F5@mac.com>
Hi Quinn,
sorry for the delay, somehow I missed your answer (probably because
the mailing list digest only arrived two days ago, 9 days after you
sent the answer ;-).
Am 27.03.2008 um 16:12 schrieb Quinn :
> At 23:23 +0100 17/3/08, Mike Fischer wrote:
>> So far, looking at tn2083 and the man pages, I don't see any way to
>> have a depency on USB or IOKit in general. Am I missing something
>> here?
>
> No, you're not missing something. This is a much-requested feature
> that we're tracking as .
OK. If we go ahead with this project I'll probably file a (duplicate)
bug to raise the priority.
>> If there is no direct support would it make sense to have a very
>> small, lightweight daemon always running that registers for IOKit
>> IOServiceAddMatchingNotification notifications and creates a
>> semaphore file that can be used to trigger the launch of the real
>> daemon for example?
>
> That's a fine way to do it. I probably wouldn't use a semaphore
> file, because it persists in the file system. However, there are
> numerous other options available to you. If I was doing this, I'd
> probably have your main daemon register a UNIX domain socket and have
> your lightweight daemon connect to that socket to trigger a launch.
OK. The semaphore file was just the first trigger I could think of
that would work with launchd. The UNIX domain socket is probably a
better idea.
If I understand this correctly I would not be using the socket for
actual communication, just for triggering the launch of the "server",
i.e. the real (on demand) daemon? So I'd include something like this
in the real daemon's launchd.plist:
Sockets
Listeners
SockNodeName
/tmp/MYSOCKETNAME
Would I need to add the SockFamily or SockProtocol keys and if so
what would be the correct values for a UNIX domain socket?
Anything else I'd need to add?
In the real daemon I'd do a socket(2), bind(2), accept(2) (the listen
(2) is already done by launchd I gather)? Or do I need this at all?
And in the USB-Watcher daemon I'd do a socket(2), connect(2), which
would trigger the launch of the real daemon right?
BTW: The launchd.plist(5) man page contains references to a launch(3)
man page (10.5.2, Xcode 3.0 as well as 10.4.11, Xcode 2.4.1).
Unfortunatly the launch(3) man page does not seem to exist. Filed as
. I saw /usr/include/launch.h and the SampleD sample
code but these don't really explain what is going on and how to
properly check-in with launchd. Any hints on where to get more
information?
>> BTW: This would be mainly for Leopard, although Tiger would be
>> interesting too.
>
> This approach would work just fine on 10.4.x (x >= 6 if you use UNIX
> domain sockets).
Good to know. Now I need to discuss these options with my customer
and see if we can do this without completely changing their existing
cross platform code.
Thanks! Your answer is very much appreciated.
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Web:
Note: I read this list in digest mode!
Send me a private copy for faster responses.
From mike_fischer at mac.com Sat Mar 29 14:15:38 2008
From: mike_fischer at mac.com (Mike Fischer)
Date: Sat Mar 29 14:14:50 2008
Subject: [launchd-dev] How to on demand launch for configurable port number?
Message-ID: <1451A34B-4D3A-48D9-84F3-C3F9657CD40A@mac.com>
Hi!
Let's say I have a daemon that listens on a TCP port. The exact port
number can be configured, i.e. it is not fixed. It might even change
when the user changes the configuration, albeit not very often.
Actually this daemon is a HTTP server that serves status information
about a service. Thus it will not be used most of the time. Always
running the server would be a waste of resources IMHO and I want
avoid that by making it an on-demand service.
Is it possible to make launchd launch the daemon on demand when a
connection request comes in? If so how would I specify this in the
launchd.plist file, taking into account the varying TCP port number?
Currently I'd immagine that I need to 'launchctl stop' the service,
modify the associated launchd.plist to reflect the currently
configured port and then 'launchctl start' the service. Unless of
course there is a better way that doesn't involve changing the
launchd.plist?
Not sure if this is relevant but the daemon does not use Bonjour at
the moment to advertise its service. That could be added though (and
might be a good idea for other reasons).
I tried to find similar services, for example the Apache Web Server.
But while it uses configurable port numbers it does not launch on
demand unfortunatly. So I can't use it as an example of how to do this.
Thanks!
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Web:
Note: I read this list in digest mode!
Send me a private copy for faster responses.