[launchd-dev] Disabling of launchd job if program is missing

Dreamcat4 dreamcat4 at gmail.com
Tue Jul 6 04:27:40 PDT 2010


If Launchd doesnt cover it, then can be fixed by doing some extra
work. For example:

1)
If you call a runner script from your launchd job, instead of invoking
the tool directly, then you can write in the runner script a
proceedure to uninstall or disable the job (and associated script
file, plist file), for the special case when tool is not found.

Otherwise if tool is found then execute it normally.

The runner script should be installed to an less apparent location
such as application support folder, etc.

2)
Another possibility is to give users an uninstall option in the .pkg
installer. That should delete the remaining plist file and disable the
launchd service. They can run the uninstaller to remove remaining
files after a failed installation.

3)
Develop a menu item in GUI app to install / uninstall the launchd
service. That is a better mechanism for most users. A menu item is
something relatively easy to point to in your help / support
documentation.


On Tue, Jul 6, 2010 at 10:29 AM, Vera Tkachenko <ivira at macpaw.com> wrote:
> Hello,
>
> in my program I use quite a simple launchd jobs to perform some tasks. This job is configured to run some tool when certain conditions are met. All works fine except one case. When user deletes this tool (e.g. after incorrect uninstall of program), then launchd fails to find tool and therefore fails to run my job.
>
> The following error is logged:
> 25/04/2010 23:26:11     com.apple.launchd.peruser.501[224] (<job label>[89736]) posix_spawn(<path to tool>, ...): No such file or directory
>
> The problem is that after this launchd keep trying to run this job. Why it just don't disable this job? If this is desired behavior, is it possible to configure it somehow to disable job if it's tool is missing?
> This is not just my software problem. Lots of other programs have such issues.
>
> --
> Thanks,
> Vera Tkachenko
>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
>


More information about the launchd-dev mailing list