Re: LaunchDaemon exits immediately, but keeps running when I run it directly
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soggywizards-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=ttidWdWkvmVjX2L8aRaK7A/bPEjbgDCcNizTeA5rcmk=; b=ALn7wF1G1fIf0/wFKdOTyP9USf5A1Cfkzq1BKUQ/soWXh8sPrAwlv3OV4WA1oZef0n /DHJxGxs/5PRRbWTwry+c9/PkYZew7qb5mhCcUmOWIqLEfI/t2x/YYGbBO1pOg0vJeSG hR3Xz3zB+6TQWofesizena/1amvwXW/wIqZpKSvUvt/SBbGbyeEjuasBoJK3mOOqgAPI 5jshE3sCdJQgAYXiD2jOrzwODdKbOJexgj/ye4olAB/YVaxj3q0O3HiFPkxiWTTsnd0f qWnWY2HQyLG2nvJQYP0KobG1qM2Yea+AUQlXz8CG6YkHXeQ1Gqa/pizLrHjmTScq9ZVW y/Nw==
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 <ssudre@intego.com> 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 mike@soggywizards.com
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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-dev/ssudre%40intego.com
This email sent to ssudre@intego.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app... This email sent to site_archiver@lists.apple.com
participants (1)
-
Michael Crawford