HomeApplelaunchd - Sending Notifications to a specified consumer from a launchctrl daemon

launchd – Sending Notifications to a specified consumer from a launchctrl daemon


I’ve created a daemon that runs at system startup, and has root privileges; name it a ‘system daemon’. I’ve created this daemon utilizing the LaunchControl app. This daemon runs a bash script as soon as per day that displays an off-site useful resource, and I wish to have it ship a Notification to my “common consumer” account on my Mac.

Here’s a simplified model of the script:

#!/choose/native/bin/bash

PATH=/choose/native/libexec/gnubin:/choose/native/bin:$PATH

osascript -e 'show notification "** That is solely a take a look at **" with title "NOTICE of Notification"'

contact /Customers/seamus/Desktop/NOTICEOFNOTHING.TXT

I added the contact command to confirm the daemon & script are literally working. I do see the file created on my Desktop, however I get no Notification.

I’ve completed some analysis utilizing the time period ‘macos osascript publish “notification” to specified consumer’, and associated phrases – however I’m not turning up something helpful. I do not truly know that it’s doable to do that as I am making an attempt to do it, however it definitely looks as if an inexpensive use of the Notifications facility!

I suppose I may create a “Consumer Agent” in LaunchControl to verify for the presence of the file created by the “system daemon”, however that appears such a kludge for a contemporary OS.

Additionally – it has been recommended elsewhere that posting a Notification to a consumer from a system daemon is one way or the other a “safety concern”?! However it’s unclear how posting a consumer Notification could be a safety concern when the root consumer can log a daily consumer off – and even render the complete system unusable.

And so my query: Can somebody inform me the way to concern a notification to a daily consumer from a “system daemon”?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments