From nlwan at nps.edu Mon Jul 7 11:48:40 2008 From: nlwan at nps.edu (Nathan Wan) Date: Mon, 7 Jul 2008 11:48:40 -0700 Subject: [launchd-dev] noob question you all can answer Message-ID: <9FFFCE837D084E229CF2D95B92AF0F49@reeves> Hi all I am trying to write a daemon, but I cannot seem to get it to load at boot time. On the system log, it says something to the effect of "dubious file permissions". I asked by accident on the cocoa mailing list, it they say it's because my plist in /Library/LaunchDaemon is not owned by the root with 644 permissions; but I have sudo'd, chmod'ed, chown'd to no avail. I cannot change ownership of the file to root. If this is the real problem, how do I fix it? If not, how do I fix it? Thanks Nathan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080707/adb87d02/attachment.html From shawnce at gmail.com Mon Jul 7 12:05:48 2008 From: shawnce at gmail.com (Shawn Erickson) Date: Mon, 7 Jul 2008 12:05:48 -0700 Subject: [launchd-dev] noob question you all can answer In-Reply-To: <9FFFCE837D084E229CF2D95B92AF0F49@reeves> References: <9FFFCE837D084E229CF2D95B92AF0F49@reeves> Message-ID: On Mon, Jul 7, 2008 at 11:48 AM, Nathan Wan wrote: > I cannot change ownership of the file to root. What do you mean by this? How can you not change it? -Shawn From nlwan at nps.edu Mon Jul 7 12:20:10 2008 From: nlwan at nps.edu (Nathan Wan) Date: Mon, 7 Jul 2008 12:20:10 -0700 Subject: [launchd-dev] noob question you all can answer In-Reply-To: References: <9FFFCE837D084E229CF2D95B92AF0F49@reeves> Message-ID: <23BC0C99C90842608637C5923DED4D52@reeves> When I try "sudo chown root:wheel ", there's no root password, but "ls -l" shows that the plist is still owned by the user:staff -----Original Message----- From: Shawn Erickson [mailto:shawnce at gmail.com] Sent: Monday, July 07, 2008 12:06 PM To: Nathan Wan Cc: launchd-dev at lists.macosforge.org Subject: Re: [launchd-dev] noob question you all can answer On Mon, Jul 7, 2008 at 11:48 AM, Nathan Wan wrote: > I cannot change ownership of the file to root. What do you mean by this? How can you not change it? -Shawn From eskimo1 at apple.com Tue Jul 8 01:47:31 2008 From: eskimo1 at apple.com (Quinn) Date: Tue, 8 Jul 2008 09:47:31 +0100 Subject: [launchd-dev] noob question you all can answer In-Reply-To: <23BC0C99C90842608637C5923DED4D52@reeves> References: <9FFFCE837D084E229CF2D95B92AF0F49@reeves> <23BC0C99C90842608637C5923DED4D52@reeves> Message-ID: At 11:48 -0700 7/7/08, Nathan Wan wrote: >On the system log, it says something to the effect of "dubious file >permissions". [...] If this is the real problem, how do I fix it? >If not, how do I fix it? Yes. The launchd plist file must be owned by root with an owning group of wheel. Also, it must not be writable by anyone other than root. Additionally, the daemon's code must follow the same rules. You can do this with the following commands: $ sudo chown root:wheel /Library/LaunchDaemons/com.example.MyDaemon.plist $ sudo chmod 644 /Library/LaunchDaemons/com.example.MyDaemon.plist $ sudo chown root:wheel /path/to/com.example.MyDaemon $ sudo chmod 755 /path/to/com.example.MyDaemon where: o "/Library/LaunchDaemons/com.example.MyDaemon.plist" is the path to your launchd property list file and o "/path/to/com.example.MyDaemon" is the path to your daemon. At 12:20 -0700 7/7/08, Nathan Wan wrote: >When I try "sudo chown root:wheel ", there's no root password, but >"ls -l" shows that the plist is still owned by the user:staff Sounds like something has gone horribly wrong with . What does the following print: $ sudo id Password: uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),8(procview),102(com.apple.sharepoint.group.2),29(certusers),3(sys),9(procmod),4(tty),1028(pseudousers),101(com.apple.sharepoint.group.1),80(admin),5(operator),300(dba),20(staff) If it doesn't list "uid=0(root) gid=0(wheel)" as the first entries, your sudo installation is broken. S+E -- Quinn "The Eskimo!" Apple Developer Relations, Developer Technical Support, Core OS/Hardware From nlwan at nps.edu Tue Jul 8 10:16:41 2008 From: nlwan at nps.edu (Wan, Nathan (CIV)) Date: Tue, 8 Jul 2008 10:16:41 -0700 Subject: [launchd-dev] noob question you all can answer References: <9FFFCE837D084E229CF2D95B92AF0F49@reeves><23BC0C99C90842608637C5923DED4D52@reeves> Message-ID: nothing prints after "Password:" no matter when command I type after sudo. For example, "sudo ls" has no output after "Password:", neither does "sudo id" How do I fix this? Thanks -----Original Message----- From: launchd-dev-bounces at lists.macosforge.org on behalf of Quinn Sent: Tue 7/8/2008 1:47 AM To: launchd-dev at lists.macosforge.org Subject: Re: [launchd-dev] noob question you all can answer At 11:48 -0700 7/7/08, Nathan Wan wrote: >On the system log, it says something to the effect of "dubious file >permissions". [...] If this is the real problem, how do I fix it? >If not, how do I fix it? Yes. The launchd plist file must be owned by root with an owning group of wheel. Also, it must not be writable by anyone other than root. Additionally, the daemon's code must follow the same rules. You can do this with the following commands: $ sudo chown root:wheel /Library/LaunchDaemons/com.example.MyDaemon.plist $ sudo chmod 644 /Library/LaunchDaemons/com.example.MyDaemon.plist $ sudo chown root:wheel /path/to/com.example.MyDaemon $ sudo chmod 755 /path/to/com.example.MyDaemon where: o "/Library/LaunchDaemons/com.example.MyDaemon.plist" is the path to your launchd property list file and o "/path/to/com.example.MyDaemon" is the path to your daemon. At 12:20 -0700 7/7/08, Nathan Wan wrote: >When I try "sudo chown root:wheel ", there's no root password, but >"ls -l" shows that the plist is still owned by the user:staff Sounds like something has gone horribly wrong with . What does the following print: $ sudo id Password: uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),8(procview),102(com.apple.sharepoint.group.2),29(certusers),3(sys),9(procmod),4(tty),1028(pseudousers),101(com.apple.sharepoint.group.1),80(admin),5(operator),300(dba),20(staff) If it doesn't list "uid=0(root) gid=0(wheel)" as the first entries, your sudo installation is broken. S+E -- Quinn "The Eskimo!" Apple Developer Relations, Developer Technical Support, Core OS/Hardware _______________________________________________ launchd-dev mailing list launchd-dev at lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080708/ccd888ac/attachment.html From hamish at gmail.com Tue Jul 8 11:04:03 2008 From: hamish at gmail.com (Hamish Allan) Date: Tue, 8 Jul 2008 19:04:03 +0100 Subject: [launchd-dev] noob question you all can answer In-Reply-To: References: <9FFFCE837D084E229CF2D95B92AF0F49@reeves> <23BC0C99C90842608637C5923DED4D52@reeves> Message-ID: <597e7edb0807081104q5518407dh3d932aa57b7040e9@mail.gmail.com> On Tue, Jul 8, 2008 at 6:16 PM, Wan, Nathan (CIV) wrote: > nothing prints after "Password:" no matter when command I type after sudo. > For example, "sudo ls" has no output after "Password:", neither does "sudo > id" How do I fix this? I'm late to this discussion, but presumably you're typing in your password when prompted, and pressing return? Hamish From nlwan at nps.edu Tue Jul 8 12:02:01 2008 From: nlwan at nps.edu (Wan, Nathan (CIV)) Date: Tue, 8 Jul 2008 12:02:01 -0700 Subject: [launchd-dev] noob question you all can answer References: <9FFFCE837D084E229CF2D95B92AF0F49@reeves><23BC0C99C90842608637C5923DED4D52@reeves> <597e7edb0807081104q5518407dh3d932aa57b7040e9@mail.gmail.com> Message-ID: Thanks everyone, turns out all I needed to do was enable the root user. -----Original Message----- From: Hamish Allan [mailto:hamish at gmail.com] Sent: Tue 7/8/2008 11:04 AM To: Wan, Nathan (CIV) Cc: Quinn; launchd-dev at lists.macosforge.org Subject: Re: [launchd-dev] noob question you all can answer On Tue, Jul 8, 2008 at 6:16 PM, Wan, Nathan (CIV) wrote: > nothing prints after "Password:" no matter when command I type after sudo. > For example, "sudo ls" has no output after "Password:", neither does "sudo > id" How do I fix this? I'm late to this discussion, but presumably you're typing in your password when prompted, and pressing return? Hamish -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080708/647dea43/attachment.html From shawnce at gmail.com Tue Jul 8 12:18:10 2008 From: shawnce at gmail.com (Shawn Erickson) Date: Tue, 8 Jul 2008 12:18:10 -0700 Subject: [launchd-dev] noob question you all can answer In-Reply-To: References: <9FFFCE837D084E229CF2D95B92AF0F49@reeves><23BC0C99C90842608637C5923DED4D52@reeves> <597e7edb0807081104q5518407dh3d932aa57b7040e9@mail.gmail.com> Message-ID: On Jul 8, 2008, at 12:02 PM, "Wan, Nathan (CIV)" wrote: > Thanks everyone, turns out all I needed to do was enable the root user You should never need to enable the root account on Mac OS X. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080708/e135d1f4/attachment.html From donmontalvo at mac.com Wed Jul 9 18:43:31 2008 From: donmontalvo at mac.com (Don Montalvo) Date: Wed, 09 Jul 2008 21:43:31 -0400 Subject: [launchd-dev] noob question you all can answer In-Reply-To: References: Message-ID: Shawn Erickson wrote: > You should never need to enable the root account on Mac OS X. At the sake of starting another UNIX holy war......why not? Don From shawnce at gmail.com Thu Jul 10 07:35:56 2008 From: shawnce at gmail.com (Shawn Erickson) Date: Thu, 10 Jul 2008 07:35:56 -0700 Subject: [launchd-dev] noob question you all can answer In-Reply-To: References: Message-ID: On Wed, Jul 9, 2008 at 6:43 PM, Don Montalvo wrote: > Shawn Erickson wrote: > >> You should never need to enable the root account on Mac OS X. > > At the sake of starting another UNIX holy war......why not? Note I very clearly said "you should never need to enable" not "you should never enable" however one could sensibly argue for the later. Any user that is given administrative rights on the system (check box in account preferences) has the ability to use sudo to execute privileged commands using their own account password (unless the default configuration for sudo is modified to not allow this). Also any graphical tool that needs privileges should utilize authorization services and launchd to fire up a utility, etc. that carry out the privileged operation. In other words the user just needs to authenticate they don't need to login in as root. If you want non-admin users to have sudo ability you can modify the sudoers file to allow specific users or secondary groups to use sudo by providing the user name and password of an account that does have administrative rights. The root account on Mac OS X is generally meant to be an account for use by the OS itself and not one that you would normally login as (aka the system doesn't allow login as root by default). -Shawn From shawnce at gmail.com Thu Jul 10 07:40:22 2008 From: shawnce at gmail.com (Shawn Erickson) Date: Thu, 10 Jul 2008 07:40:22 -0700 Subject: [launchd-dev] noob question you all can answer In-Reply-To: References: Message-ID: On Thu, Jul 10, 2008 at 7:35 AM, Shawn Erickson wrote: > On Wed, Jul 9, 2008 at 6:43 PM, Don Montalvo wrote: >> Shawn Erickson wrote: >> >>> You should never need to enable the root account on Mac OS X. >> >> At the sake of starting another UNIX holy war......why not? > > Note I very clearly said "you should never need to enable" not "you > should never enable" however one could sensibly argue for the later. ...and my intended point relevant to this email thread is that enabling root is overkill for the simple task that the OP was trying to do (sudo chown ...). It isn't clear why he couldn't get sudo to work but he didn't give us enough information about how his user was configured, etc. to help him. -Shawn From vivacarlie at gmail.com Thu Jul 10 18:40:13 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Thu, 10 Jul 2008 20:40:13 -0500 Subject: [launchd-dev] noob question you all can answer (Don Montalvo) Message-ID: <65fadfc30807101840ib3a50d3m62dd162d71e56896@mail.gmail.com> It is a simple manor of stopping you from shooting your self in the foot. if you log in as root, there will be no warnings to you from doing such things as deleting core frameworks and the like. (this is from experience) Also, not running as an administrative user to do everyday tasks like email would keep you from being infected with trojans (there exist dangerous mac malware!) without at least SOME input from you. enabling the root password has been easiest way for me to use macports but thats me. -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080710/f47c8190/attachment.html From smith.kennedy at hp.com Fri Jul 11 14:06:37 2008 From: smith.kennedy at hp.com (Smith Kennedy) Date: Fri, 11 Jul 2008 15:06:37 -0600 Subject: [launchd-dev] OnDemand USB Software In-Reply-To: References: <79305EFD-C4A3-4979-85FD-2EC365A7947A@mac.com> Message-ID: Greetings, We did something like this but without launchd being involved: a lightweight USB monitor daemon that merely registers for IOKit attach notifications, and that launches the "real" processes on device connect. We have been doing this since Mac OS 10.1, and the usb monitor daemon consumes nearly zero resources. But some (including myself) don't like seeing daemons running for no good reason. We had hoped to eliminate that daemon with the appearance of launchd in Mac OS 10.4. Unfortunately, launchd has never supported IOKit events in general or USB connection events specifically. I filed Radar # 4297231 back in October 2005, after attending WWDC 2005. In the launchd session's Q&A, I asked about USB connection event support, but was told that it didn't support it. I had hoped that my Radar would get it added before Tiger shipped, but no such luck. I asked about it again at WWDC 2006 but was told that it remained an open issue, and remains open to this day, unfortunately. Interestingly, Radar # 4297231 is not flagged as a duplicate of the defect list below, but instead is still listed as "Open". It is possible that there are others out there as well (Radar limits my view as I am not an Apple employee). I would love for this to be resolved, if for no other reason than to close the book on this particular issue. I know that launchd is one of the projects hosted on macosforge.org. I have considered working on this as a third-party contribution, but cannot tell whether it would be accepted by the launchd macosforge project, or by Apple for inclusion in Mac OS X. And time rolls on... Smith On Mar 18, 2008, at 4:09 AM, Quinn wrote: > 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 > _______________________________________________ > launchd-dev mailing list > launchd-dev at lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev From ubuntulist at yandex.ru Fri Jul 18 07:22:07 2008 From: ubuntulist at yandex.ru (Vyacheslav Karamov) Date: Fri, 18 Jul 2008 17:22:07 +0300 Subject: [launchd-dev] XCode 3.0. Unresolved externals Message-ID: <4880A70F.2010908@yandex.ru> Hi All! I've made launchd-enabled daemon with XCode 2.4, but with XCode 3.0 I get some unresolved externals. Should I add any framework to my project? From eskimo1 at apple.com Fri Jul 18 09:51:15 2008 From: eskimo1 at apple.com (Quinn) Date: Fri, 18 Jul 2008 17:51:15 +0100 Subject: [launchd-dev] XCode 3.0. Unresolved externals In-Reply-To: <4880A70F.2010908@yandex.ru> References: <4880A70F.2010908@yandex.ru> Message-ID: At 17:22 +0300 18/7/08, Vyacheslav Karamov wrote: >I've made launchd-enabled daemon with XCode 2.4, but with XCode 3.0 I >get some unresolved externals. What are the externals? All of the launchd specific symbols are in the System framework, which is added to your project by default. >$ nm /System/Library/Frameworks/System.framework/System | grep launch_msg >000380bf T _launch_msg >0003a6f3 t _launch_msg_getmsgs S+E -- Quinn "The Eskimo!" Apple Developer Relations, Developer Technical Support, Core OS/Hardware From donmontalvo at mac.com Fri Jul 18 11:38:36 2008 From: donmontalvo at mac.com (Don Montalvo) Date: Fri, 18 Jul 2008 14:38:36 -0400 Subject: [launchd-dev] launchd and watchpath In-Reply-To: <1D902C25-C4B1-45E0-BF86-14871671AF24@mac.com> References: <0E3711F2-F5F4-4B44-A474-94812D86927A@apple.com> <1D902C25-C4B1-45E0-BF86-14871671AF24@mac.com> Message-ID: I'm finally getting around to this. Quick question (I know, I can begin a thread on another list...let me know if I should). What's the command to apply an ACL that forces all incoming files/folders to take on 777 permissions? I only want to change permissions, not ownership. Here's the folder: /Users/Shared/WORK The folder itself needs to be locked down so nobody can delete. Not sure if that's something that needs to be applied separately? Thanks, Don On Jun 9, 2008, at 3:26 PM, Don Montalvo wrote: > Dave, thanks for the feedback. I'll go the ACL route. > > Don > > On Jun 9, 2008, at 1:11 PM, Dave Zarzycki wrote: > >> Don, >> >> What you are proposing is inherently fragile due to race >> conditions. Please pursue the ACL option further if you care about >> reliability. Thanks! >> >> davez >> >> >> On Jun 8, 2008, at 5:14 PM, Don Montalvo wrote: >> >>> Of course I meant "Instead of ACL's" >>> >>> -Don >>> >>> Date: Sun, 08 Jun 2008 10:07:33 -0400 >>>> From: Don Montalvo >>>> Subject: [launchd-dev] launchd and watchpath >>>> To: launchd-dev at lists.macosforge.org >>>> Message-ID: <41D7B3A5-6EAC-4647-8ACB-D2378ABD170C at mac.com> >>>> Content-Type: text/plain; charset=US-ASCII; format=flowed; >>>> delsp=yes >>>> >>>> We would like to set up a folder on our Macs that forces incoming >>>> files/folders to inherit permissions. Instead of ADL's, we'd like >>>> to >>>> use launchd (and watchpath). I'm not familiar with launchd, so I >>>> think >>>> this would be a good way to get my feet wet. >>>> >>>> The shared folder would be: >>>> >>>> /Users/Shared/WORK >>>> >>>> Each user would have an alias to it on their Desktop (created via >>>> logout hook): >>>> >>>> ~/Desktop/WORK >>>> >>>> How can I set up launchd to watch this folder and ensure the >>>> contents >>>> are always set to 777? I don't have experience with launchd. I >>>> toyed >>>> with it in early Tiger days but there were issues with user >>>> launchd so >>>> I gave it up and stuck with cron. I understand launchd works as >>>> advertised on Leopard. Hoping it can help with this little >>>> project. :) >>>> >>>> Thanks, >>>> Don >>> _______________________________________________ >>> launchd-dev mailing list >>> launchd-dev at lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev >> > From ubuntulist at yandex.ru Mon Jul 21 02:48:03 2008 From: ubuntulist at yandex.ru (Vyacheslav Karamov) Date: Mon, 21 Jul 2008 12:48:03 +0300 Subject: [launchd-dev] XCode 3.0. Unresolved externals In-Reply-To: References: <4880A70F.2010908@yandex.ru> Message-ID: <48845B53.5090206@yandex.ru> /Developer/usr/bin/g++-4.0 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/Release -F/Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/Release -filelist /Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/AudioServer.build/Release/AudioServer.build/Objects-normal/ppc/AudioServer.LinkFileList -mmacosx-version-min=10.4 -framework CoreAudio /Volumes/Untitled/Slavik/Projects/Mac/build/Release/liboggstatic.a /Volumes/Untitled/Slavik/Projects/Mac/build/Release/libvorbisstatic.a /Volumes/Untitled/Slavik/Projects/Mac/build/Release/libTLSoundStatic.a -framework QuickTime -framework Foundation -framework Carbon -o /Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/AudioServer.build/Release/AudioServer.build/Objects-normal/ppc/AudioServer Undefined symbols: "launch_data_dict_lookup(_launch_data*, char const*)", referenced from: _main in main.o "launch_data_get_type(_launch_data*)", referenced from: _main in main.o "launch_msg(_launch_data*)", referenced from: _main in main.o "launch_data_get_string(_launch_data*)", referenced from: _main in main.o "launch_data_free(_launch_data*)", referenced from: _main in main.o "launch_data_new_string(char const*)", referenced from: _main in main.o "launch_data_get_errno(_launch_data*)", referenced from: _main in main.o ld: symbol(s) not found collect2: ld returned 1 exit status Quinn wrote: > At 17:22 +0300 18/7/08, Vyacheslav Karamov wrote: > >> I've made launchd-enabled daemon with XCode 2.4, but with XCode 3.0 I >> get some unresolved externals. >> > > What are the externals? All of the launchd specific symbols are in > the System framework, which is added to your project by default. > > >> $ nm /System/Library/Frameworks/System.framework/System | grep launch_msg >> 000380bf T _launch_msg >> 0003a6f3 t _launch_msg_getmsgs >> > > S+E > From ubuntulist at yandex.ru Mon Jul 21 05:18:43 2008 From: ubuntulist at yandex.ru (Vyacheslav Karamov) Date: Mon, 21 Jul 2008 15:18:43 +0300 Subject: [launchd-dev] XCode 3.0. Unresolved externals In-Reply-To: <48845B53.5090206@yandex.ru> References: <4880A70F.2010908@yandex.ru> <48845B53.5090206@yandex.ru> Message-ID: <48847EA3.8080705@yandex.ru> I've "solved" :((((((((( this problem by changing "Target OS" from 10.4 to 10.5. Why? Why I have to? Vyacheslav Karamov wrote: > /Developer/usr/bin/g++-4.0 -arch ppc -isysroot > /Developer/SDKs/MacOSX10.4u.sdk > -L/Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/Release > -F/Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/Release > -filelist > /Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/AudioServer.build/Release/AudioServer.build/Objects-normal/ppc/AudioServer.LinkFileList > -mmacosx-version-min=10.4 -framework CoreAudio > /Volumes/Untitled/Slavik/Projects/Mac/build/Release/liboggstatic.a > /Volumes/Untitled/Slavik/Projects/Mac/build/Release/libvorbisstatic.a > /Volumes/Untitled/Slavik/Projects/Mac/build/Release/libTLSoundStatic.a > -framework QuickTime -framework Foundation -framework Carbon -o > /Volumes/Untitled/Slavik/Projects/Mac/AudioServer/../build/AudioServer.build/Release/AudioServer.build/Objects-normal/ppc/AudioServer > Undefined symbols: > "launch_data_dict_lookup(_launch_data*, char const*)", referenced from: > _main in main.o > "launch_data_get_type(_launch_data*)", referenced from: > _main in main.o > "launch_msg(_launch_data*)", referenced from: > _main in main.o > "launch_data_get_string(_launch_data*)", referenced from: > _main in main.o > "launch_data_free(_launch_data*)", referenced from: > _main in main.o > "launch_data_new_string(char const*)", referenced from: > _main in main.o > "launch_data_get_errno(_launch_data*)", referenced from: > _main in main.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > > > Quinn wrote: > >> At 17:22 +0300 18/7/08, Vyacheslav Karamov wrote: >> >> >>> I've made launchd-enabled daemon with XCode 2.4, but with XCode 3.0 I >>> get some unresolved externals. >>> >>> >> What are the externals? All of the launchd specific symbols are in >> the System framework, which is added to your project by default. >> >> >> >>> $ nm /System/Library/Frameworks/System.framework/System | grep launch_msg >>> 000380bf T _launch_msg >>> 0003a6f3 t _launch_msg_getmsgs >>> >>> >> S+E >> >> > > From eskimo1 at apple.com Mon Jul 21 08:03:00 2008 From: eskimo1 at apple.com (Quinn) Date: Mon, 21 Jul 2008 16:03:00 +0100 Subject: [launchd-dev] XCode 3.0. Unresolved externals In-Reply-To: <48847EA3.8080705@yandex.ru> References: <4880A70F.2010908@yandex.ru> <48845B53.5090206@yandex.ru> <48847EA3.8080705@yandex.ru> Message-ID: At 15:18 +0300 21/7/08, Vyacheslav Karamov wrote: >I've "solved" :((((((((( this problem by changing "Target OS" from 10.4 >to 10.5. >Why? Why I have to? This is because of a bug in the 10.4 SDK. In that SDK the "launch.h" file does not include the necessary stuff to prevent C++ name mangling of the launchd functions (the __BEGIN_DECLS and __END_DECLS macros). Thus, when you include the file from a C++ program, the names get mangled and the linker can't find them in the System framework. This bug is fixed in the 10.5 SDK. It's unlikely to ever be fixed in the 10.4 SDK because the 10.4 SDK is deliberately designed to reflect the state of the system at the time when 10.4 was released. You may be able to work around this problem by changing: #include to: extern "C" { #include }; S+E -- Quinn "The Eskimo!" Apple Developer Relations, Developer Technical Support, Core OS/Hardware From trodemaster at gmail.com Wed Jul 23 19:15:44 2008 From: trodemaster at gmail.com (Blake Garner) Date: Wed, 23 Jul 2008 19:15:44 -0700 Subject: [launchd-dev] run once and then vaporize Message-ID: <55a5c7c50807231915y1cd1cde6wa5996c884c692c61@mail.gmail.com> I'm hoping that an elegant solution exists for launchd to kick off a script on boot as root and then unload and remove itself. I understand that login hooks and startup items may be simpler but I would prefer to use a launchd plist as it fits better with our automation system. This is what I have right now.. Label runonce ProgramArguments /Library/Scripts/runonce.sh ; /bin/launchctl unload -w /Library/LaunchDaemons/runonce.plist ; /usr/bin/rm /Library/LaunchDaemons/runonce.plist RunAtLoad My test script currently just echo's some text into system.log and exits. The script runs but the launchd item fails to unload or remove itself. Ideally I would like to keep the removal function in the launchd item. Suggestions and links to similar examples are welcome. Thanks, Blake From subscriber at gloaming.com Thu Jul 24 07:49:06 2008 From: subscriber at gloaming.com (James Bucanek) Date: Thu, 24 Jul 2008 07:49:06 -0700 Subject: [launchd-dev] run once and then vaporize In-Reply-To: <55a5c7c50807231915y1cd1cde6wa5996c884c692c61@mail.gmail.com> Message-ID: Blake Garner wrote (Wednesday, July 23, 2008 7:15 PM -0700): >I'm hoping that an elegant solution exists for launchd to kick off a >script on boot as root and then unload and remove itself. I understand >that login hooks and startup items may be simpler but I would prefer >to use a launchd plist as it fits better with our automation system. > >This is what I have right now.. > > >"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> > > >Label >runonce >ProgramArguments > >/Library/Scripts/runonce.sh >; >/bin/launchctl >unload >-w >/Library/LaunchDaemons/runonce.plist >; >/usr/bin/rm >/Library/LaunchDaemons/runonce.plist > >RunAtLoad > > > > >My test script currently just echo's some text into system.log and >exits. The script runs but the launchd item fails to unload or remove >itself. Ideally I would like to keep the removal function in the >launchd item. The elements of the ProgramArguments key are the arguments passed to your script. There is no shell or scripting language involved. Your script was simply passed the literal arguments runonce.sh ';' '/bin/launchctl' unload -w '/Library/LaunchDaemons/runonce.plist' ';' ... As the documentation for ProgramArguments says: Please read execvp(3) very carefully! Unless runonce.sh takes the remainder of its command line arguments and passes them to a shell for execution, nothing else will happen. If you want your daemon to uninstall itself after running, it will need to do that itself. -- James Bucanek From eskimo1 at apple.com Thu Jul 24 07:43:28 2008 From: eskimo1 at apple.com (Quinn) Date: Thu, 24 Jul 2008 15:43:28 +0100 Subject: [launchd-dev] run once and then vaporize In-Reply-To: <55a5c7c50807231915y1cd1cde6wa5996c884c692c61@mail.gmail.com> References: <55a5c7c50807231915y1cd1cde6wa5996c884c692c61@mail.gmail.com> Message-ID: At 19:15 -0700 23/7/08, Blake Garner wrote: >My test script currently just echo's some text into system.log and >exits. The script runs but the launchd item fails to unload or remove >itself. That's because launchd does not pass the ProgramArguments to a shell; rather, it invokes fork/exec (maybe even posix_spawn these days) with those arguments. So the ";" isn't considered special. If you modify your "runonce.sh" to print all of its arguments, you'll find that it's getting a whole bunch of extra ones (-: I don't think this ProgramArguments approach is going to work. You will have to unload the job from your script. Alternatively, don't unload the job. Once a job is loaded, it doesn't depend on the plist file, so removing the plist file out from underneath launchd won't cause you any problems. The job will continue to exist in launchd (until the system restarts) but it won't get run against unless someone specifically invokes it. S+E -- Quinn "The Eskimo!" Apple Developer Relations, Developer Technical Support, Core OS/Hardware From trodemaster at gmail.com Thu Jul 24 14:48:39 2008 From: trodemaster at gmail.com (Blake Garner) Date: Thu, 24 Jul 2008 14:48:39 -0700 Subject: [launchd-dev] run once and then vaporize In-Reply-To: References: <55a5c7c50807231915y1cd1cde6wa5996c884c692c61@mail.gmail.com> Message-ID: <55a5c7c50807241448r28a28028xb15fb1787a17d730@mail.gmail.com> Thanks Quinn! Your explanation was informative and solved my problem. I attempted to have the script remove the .plist before but It was failing due to permission problems. After correcting the permissions on my script it's working! blake On Thu, Jul 24, 2008 at 7:43 AM, Quinn wrote: > At 19:15 -0700 23/7/08, Blake Garner wrote: >>My test script currently just echo's some text into system.log and >>exits. The script runs but the launchd item fails to unload or remove >>itself. > > That's because launchd does not pass the ProgramArguments to a shell; > rather, it invokes fork/exec (maybe even posix_spawn these days) with > those arguments. So the ";" isn't considered special. If you modify > your "runonce.sh" to print all of its arguments, you'll find that > it's getting a whole bunch of extra ones (-: > > I don't think this ProgramArguments approach is going to work. You > will have to unload the job from your script. > > Alternatively, don't unload the job. Once a job is loaded, it > doesn't depend on the plist file, so removing the plist file out from > underneath launchd won't cause you any problems. The job will > continue to exist in launchd (until the system restarts) but it won't > get run against unless someone specifically invokes it. > > S+E > -- > Quinn "The Eskimo!" > Apple Developer Relations, Developer Technical Support, Core OS/Hardware > _______________________________________________ > launchd-dev mailing list > launchd-dev at lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev > From cjs980 at uow.edu.au Wed Jul 30 21:09:08 2008 From: cjs980 at uow.edu.au (Chris Stevens) Date: Thu, 31 Jul 2008 14:09:08 +1000 Subject: [launchd-dev] Obtaining information about a process from launchd Message-ID: Hi all, Sorry for the somewhat basic question, I am writing a server in python that I have registered with launchd. I am using a preference pane to control the service (using "launchctl start/stop"), but I would like the preference pane to know if the service is actually running. Because it is a python script, the process shows up just as 'Python', so tracking the process using NSWorkspace launchedApplications (actually I just read this may not work anyway) would not work if the user happens to be using other python scripts. Is there a way to get the status of my process from launchd? Since launchd is controlling the whole show, I thought there must be some method to find out if my python script is actually running, stopped, dead, whatever. Thankyou! Chris. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.macosforge.org/pipermail/launchd-dev/attachments/20080731/8ce66ccb/attachment.html From eskimo1 at apple.com Thu Jul 31 02:35:05 2008 From: eskimo1 at apple.com (Quinn) Date: Thu, 31 Jul 2008 10:35:05 +0100 Subject: [launchd-dev] Obtaining information about a process from launchd In-Reply-To: References: Message-ID: At 14:09 +1000 31/7/08, Chris Stevens wrote: >Is there a way to get the status of my process from launchd? Since >launchd is controlling the whole show, I thought there must be some >method to find out if my python script is actually running, stopped, >dead, whatever. You can do this using 's "list" command. For example: $ sudo launchctl list com.anarchistturtle.FluffyProxy-ssh { "Label" = "com.anarchistturtle.FluffyProxy-ssh"; "LimitLoadToSessionType" = "System"; "OnDemand" = false; "LastExitStatus" = 0; "PID" = 14348; "TimeOut" = 30; "StandardOutPath" = "/var/log/FluffyProxy.log"; "StandardErrorPath" = "/var/log/FluffyProxy.log"; "ProgramArguments" = ( "/MyLaunchDaemons/FluffyProxy-ssh.sh"; ); }; shows that the process associated with the job if it's actually running (it has a "PID" property). I believe that you can this info programmatically using the launchmsg API with the LAUNCH_KEY_GETJOB command. The tricky part is updating the status dynamically without polling. For the running-to-not-running case, that's easy. Just use a kqueue with NOTE_EXIT. For the not-running-to-running case, I can't think of any good solutions. You might just want to have your daemon post a notification (using ) when it starts up. S+E -- Quinn "The Eskimo!" Apple Developer Relations, Developer Technical Support, Core OS/Hardware