Monday, June 9, 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 check **" 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 person’, and associated phrases – however I’m not turning up something helpful. I do not truly know that it’s attainable to do that as I am making an attempt to do it, but it surely actually looks like an affordable use of the Notifications facility!

I suppose I may create a “Person Agent” in LaunchControl to test 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 tips on how to problem 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