Re: LaunchDaemon exits immediately, but keeps running when I run it directly
Re: LaunchDaemon exits immediately, but keeps running when I run it directly
- Subject: Re: LaunchDaemon exits immediately, but keeps running when I run it directly
- From: Michael Crawford <email@hidden>
- Date: Wed, 6 Dec 2017 05:18:27 -0800
> Have you tried providing the absolute path to the tool in the launchd plist
> and using the "Program" key to define the location of the tool?
That worked.
I am eternally in your debt.
On Wed, Dec 6, 2017 at 5:09 AM, Stéphane Sudre <email@hidden> wrote:
> Have you tried providing the absolute path to the tool in the launchd plist
> and using the "Program" key to define the location of the tool?
>
> On 6 déc. 2017, at 13:46, Michael Crawford wrote:
>
>> I plan to write a moderately complex daemon but must learn how with a
>> very simple one.
>>
>> system.log is full of:
>>
>> Dec 6 00:02:47 Michaels-Mac-mini com.apple.xpc.launchd[1]
>> (com.frescologic.hello): Service only ran for 0 seconds. Pushing
>> respawn out by 10 seconds.
>> Dec 6 00:02:57 Michaels-Mac-mini com.apple.xpc.launchd[1]
>> (com.frescologic.hello[1386]): Service could not initialize: 16F73:
>> xpcproxy + 11769 [1505][34964CF1-9965-3B4D-ADC7-6FBC6669C56D]: 0x2
>>
>> I googled for "Service could not initialize: 16F73" but found no insight.
>>
>> My source code:
>>
>> =================
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <unistd.h>
>>
>> int
>> main(int argc, const char * argv[])
>> {
>> FILE *outFile;
>>
>> if ( argc != 2 ){
>>
>> fprintf( stderr, "Usage:\n $ %s world\n", argv[ 0 ] );
>> exit( 1 );
>> }
>>
>> outFile = fopen( "/tmp/foo", "w" );
>> if ( outFile == NULL ) exit( 1 );
>>
>> while ( 1 ){
>> fprintf( outFile, "%s\n", argv[ 1 ] );
>> sleep( 10 );
>> }
>>
>> return 0;
>> }
>>
>> ========================
>>
>> My configuration:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
>> "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>> <plist version="1.0">
>> <dict>
>> <key>Label</key>
>> <string>com.frescologic.hello</string>
>> <key>ProgramArguments</key>
>> <array>
>> <string>hello</string>
>> <string>world</string>
>> </array>
>> <key>KeepAlive</key>
>> <true/>
>> </dict>
>>
>> /usr/local/libexec/hello and /Library/LaunchDaemons are both owned by
>> root with group wheel.
>>
>> Thank you for any advice you can give me.
>>
>> Mike Crawford
>> http://soggywizards.com
>> email@hidden
>>
>> One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Darwin-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden