11 C
New York
Monday, April 21, 2025

launchd – Sending Notifications to a specified person 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 want to have it ship a Notification to my “common person” 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 achieved some analysis utilizing the time period ‘macos osascript submit “notification” to specified person’, and associated phrases – however I’m not turning up something helpful. I do not really know that it’s potential to do that as I am making an attempt to do it, however it definitely looks like an inexpensive use of the Notifications facility!

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

Can somebody inform me the right way to situation a notification to a daily person from a “system daemon”?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles