I have created a daemon that runs at system startup, and has root privileges; call it a ‘system daemon’. I have created this daemon using the LaunchControl
app. This daemon runs a bash
script once per day that monitors an off-site resource, and I would like to have it send a Notification to my “regular user” account on my Mac.
Here is a simplified version of the script:
#!/opt/local/bin/bash
PATH=/opt/local/libexec/gnubin:/opt/local/bin:$PATH
osascript -e 'display notification "** This is only a test **" with title "NOTICE of Notification"'
touch /Users/seamus/Desktop/NOTICEOFNOTHING.TXT
I added the touch
command to verify the daemon & script are actually working. I do see the file created on my Desktop, but I get no Notification.
I’ve done some research using the term ‘macos osascript post “notification” to specified user’, and related terms – but I am not turning up anything useful. I don’t actually know that it is possible to do this as I’m attempting to do it, but it certainly seems like a reasonable use of the Notifications facility!
I suppose I could create a “User Agent” in LaunchControl to check for the presence of the file created by the “system daemon”, but that seems such a kludge for a modern OS.
Can someone tell me how to issue a notification to a regular user from a “system daemon”?