launchd

LaunchAgent - Is there something like RunAtScreenSaver?

家住魔仙堡 提交于 2020-01-15 09:32:06
问题 I am looking for a way to execute my app (it's a background task) at times, where the machine is "idle". A good incident would be when the screensaver launches. I already read the manual auf launchd and already use a LaunchAgent to lauch my app at certain intervals, but I found nothing that might help me launching my app when the screensaver is active. Is there any possibility to do that? Thanks in advance! Josh 回答1: Have another process that runs in the background and listens for distributed

psn parameter by MacOSX launchd. what can I do with it?

[亡魂溺海] 提交于 2020-01-15 08:56:43
问题 launchd passes the -psn_... parameter to an application. If I understand correctly, this parameter tells me the Process Serial Number, right? But why is it passed? Isn't it just the same as what I would get with GetCurrentProcess? If so, I don't understand why it is passed as a parameter. If that is something different, then what is this parameter and what can I do with it? Note that there is a very related question about the meaning of PSN. However, that doesn't really answers the question

Spawn a screen session from launch daemon

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-13 11:52:31
问题 I've written a launchd .plist which should attach a debugger to the WindowServer when it launches. The main part of the script looks like screen -D -m -S "WindowServer Debugger" \ gdb \ -x $GDBSCRIPT \ /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/WindowServer \ $WSPID This starts a detached screen session in which gdb is attached to WindowServer. However, this seems to trigger an error condition in launchd under

Spawn a screen session from launch daemon

橙三吉。 提交于 2020-01-13 11:52:30
问题 I've written a launchd .plist which should attach a debugger to the WindowServer when it launches. The main part of the script looks like screen -D -m -S "WindowServer Debugger" \ gdb \ -x $GDBSCRIPT \ /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/WindowServer \ $WSPID This starts a detached screen session in which gdb is attached to WindowServer. However, this seems to trigger an error condition in launchd under

Spawn a screen session from launch daemon

ε祈祈猫儿з 提交于 2020-01-13 11:52:14
问题 I've written a launchd .plist which should attach a debugger to the WindowServer when it launches. The main part of the script looks like screen -D -m -S "WindowServer Debugger" \ gdb \ -x $GDBSCRIPT \ /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/WindowServer \ $WSPID This starts a detached screen session in which gdb is attached to WindowServer. However, this seems to trigger an error condition in launchd under

script runs fine in terminal but not from launchd

China☆狼群 提交于 2020-01-06 09:55:48
问题 My Python script runs fine in the terminal but when I try to set it up to run once a day at a certain time with launchd (set up using software called Lingon), I just can't get it to run. From everything I've read, it's better to invoke the Python script from a shell script (I'm on a Macbook, running Yosemite). So, that's what I'm trying to do. The errors I get when the script is due to be run are: TERM environment variable not set. env: python3: No such file or directory At this point, I'm

Python argparse: how to handle MacOSX `-psn` parameter

喜夏-厌秋 提交于 2020-01-04 12:17:39
问题 MacOSX launchd passes the -psn... parameter to applications. How can I tell argparse how to parse the parameter? It's basically -psn_([0-9]+)_([0-9]+) but I'm fine if it just parses -psn(\S*) . Is that possible at all? (See here for some documentation about the Process Serial Number (PSN). And here is my question about what to do with the parameter.) 回答1: Looking at the structure of the psn argument, it's not possible to parse it with argparse without interfering with a possible "-p" argument

Can I import a Golang package based on the OS I'm building for?

你。 提交于 2020-01-01 16:08:09
问题 Say I have a go project that based on which OS, and in some cases which distro, I want to use say a Systemd client package vs an Upstart client package vs a sysv client package vs a launchd client package. Is it possible to selectively import each package so I only import the one I need per OS/distro I'm building for? Or do I have to import each package for each OS/distro? 回答1: Package build Build Constraints A build constraint, also known as a build tag, is a line comment that begins //

Can I import a Golang package based on the OS I'm building for?

会有一股神秘感。 提交于 2020-01-01 16:07:07
问题 Say I have a go project that based on which OS, and in some cases which distro, I want to use say a Systemd client package vs an Upstart client package vs a sysv client package vs a launchd client package. Is it possible to selectively import each package so I only import the one I need per OS/distro I'm building for? Or do I have to import each package for each OS/distro? 回答1: Package build Build Constraints A build constraint, also known as a build tag, is a line comment that begins //

PATH is getting set somewhere other than launchd.conf and I don't know where

风格不统一 提交于 2020-01-01 06:49:13
问题 The question of how to set PATH for all programs in a user session (not just Terminal) has come and been addressed. So I changed both /etc/launchd.conf AND /etc/paths, just to make sure everything was ok. However, I am still getting a different PATH envar when I launch Terminal than what I'm expecting (I'm not at all sure how to test PATH from another application.) Here's what's in /etc/launchd.conf: setenv PATH /sw/bin:/sw/sbin:/sw/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr