launch-daemon

systemd servicefailed to connect to session d-bus

一曲冷凌霜 提交于 2020-01-16 03:54:10
问题 I have a application which has to connect to session dbus during bootup. If I start my application manually or start with initd, it is starting and connecting to session dbus. But if I start through systemd by giving command as systemctl --user start my-service which is in the path "/etc/systemd/user", it is showing the following error "Failed to connect to bus: No such file or directory". What can be the possible reasons? The service file is as follows: [Unit] Description=dummy application

Mac Launch Daemon unable to retrieve password from system keychain after saving it there

前提是你 提交于 2019-12-10 13:59:01
问题 We have a Launch Daemon which (necessarily, for various reasons) runs as root, and which communicates with a server component via the network. It needs to authenticate with the service, so when it first obtains the password, we save it to the system keychain. On subsequent launches, the idea is to retrieve the password from the keychain and use it to authenticate with the network service. This has been working fine, but on macOS 10.12 the existing code stopped working, and we've been entirely

Daemon to know when a user logs into the MAC

一个人想着一个人 提交于 2019-12-07 07:05:42
问题 I have a daemon (written in Obj C) running, and I would like to perform some action when some user logs in. Is it possible for a Daemon to know when a particular user logs in or out in OSX? Are there any Notifications thrown when a log in occurs? I would like to avoid the use of Log in Item or Launch Agent. And also i would like to avoid polling on a timer to check the logged in user. 回答1: Use SCDynamicStoreCopyConsoleUser to get the console user name. CFStringRef consoleUserName = nil; uid_t

OS X - Communication between launch daemon and launch agent

ⅰ亾dé卋堺 提交于 2019-12-06 05:13:36
问题 I am new to OS X and have to create an application having 2 parts - launch daemon and launch agent. The daemon is going to do stuff such as command execution, logging, etc and has to somehow communicate these results to launch agent (which would transfer them to a login item displaying a GUI, although that is a future step). My question: How do I achieve this communication?. From what I have been able to gather so far after reading Apple docs is that my best bet is using CFSockets. Is there

Daemon to know when a user logs into the MAC

≯℡__Kan透↙ 提交于 2019-12-05 14:28:53
I have a daemon (written in Obj C) running, and I would like to perform some action when some user logs in. Is it possible for a Daemon to know when a particular user logs in or out in OSX? Are there any Notifications thrown when a log in occurs? I would like to avoid the use of Log in Item or Launch Agent. And also i would like to avoid polling on a timer to check the logged in user. Use SCDynamicStoreCopyConsoleUser to get the console user name. CFStringRef consoleUserName = nil; uid_t uid; gid_t gid; consoleUserName = SCDynamicStoreCopyConsoleUser(NULL, &uid, &gid); Store consoleUserName in

OS X - Communication between launch daemon and launch agent

柔情痞子 提交于 2019-12-04 11:36:42
I am new to OS X and have to create an application having 2 parts - launch daemon and launch agent. The daemon is going to do stuff such as command execution, logging, etc and has to somehow communicate these results to launch agent (which would transfer them to a login item displaying a GUI, although that is a future step). My question: How do I achieve this communication?. From what I have been able to gather so far after reading Apple docs is that my best bet is using CFSockets. Is there any alternate(simpler) way ? Does anybody have any sample tutorial/example/code that shows how to use

Change file extensions of multiple files in a directory with terminal/bash?

血红的双手。 提交于 2019-12-03 12:47:45
问题 I'm developing a simple launchdaemon that copies files from one directory to another. I've gotten the files to transfer over fine. I just want the files in the directory to be .mp3's instead of .dat's Some of the files look like this: 6546785.8786.dat 3678685.9834.dat 4658679.4375.dat I want them to look like this: 6546785.8786.mp3 3678685.9834.mp3 4658679.4375.mp3 This is what I have at the end of the bash script to rename the file extensions. cd $mp3_dir mv *.dat *.mp3 exit 0 Problem is the

Change file extensions of multiple files in a directory with terminal/bash?

試著忘記壹切 提交于 2019-12-03 03:11:07
I'm developing a simple launchdaemon that copies files from one directory to another. I've gotten the files to transfer over fine. I just want the files in the directory to be .mp3's instead of .dat's Some of the files look like this: 6546785.8786.dat 3678685.9834.dat 4658679.4375.dat I want them to look like this: 6546785.8786.mp3 3678685.9834.mp3 4658679.4375.mp3 This is what I have at the end of the bash script to rename the file extensions. cd $mp3_dir mv *.dat *.mp3 exit 0 Problem is the file comes out as *.mp3 instead of 6546785.8786.mp3 and when another 6546785.8786.dat file is imported

OS X - Truly 'On Demand' Privileged Helper Tool

前提是你 提交于 2019-12-02 12:43:33
问题 My application needs to write files to restricted places on the filesystem. To do so, I use a helper tool that is run as root. Everything is working correctly, following this example, my helper tool is correctly installed and run. I use this solution to be able to "wake" the helper tool, otherwise it isn't launched more than one time after initial load. The helper tool is waiting for messages to come from the main application, and executes them correctly. I also have a kind of message that