Open for-coursera opened 9 years ago
Looks like at
is somewhat disabled on OSX, that must be the issue here.
Did you find a way? I am struggling on the same problem. "at" runs fine with other commands. terminal-notifier denies to deliver the notification. I only see terminal-notifier[xxxx]: ApplePersistence=NO in the syslog.
I am having a similar issue the error output from trying to run terminal-notifier in a script called by an at command
2017-05-08 03:05:02.713 terminal-notifier[2884:28175] NSNotificationCenter connection invalid
2017-05-08 03:05:02.725 terminal-notifier[2884:28175] Connection to notification center invalid. ServerConnectionFailure: 1 invalidated: 0
2017-05-08 03:05:02.726 terminal-notifier[2884:28175] Connection to notification center invalid. ServerConnectionFailure: 1 invalidated: 0
It is not a problem with at jobs not successfully running in mac https://superuser.com/questions/43678/mac-os-x-at-command-not-working I ran the fix here and can run an at job with other files it just doesn't work specifically with this one
This is my call to terminal notifier which is inside a file that i directed the at command to execute
export DISPLAY=/private/tmp/com.apple.launchd.5jte4rZAmH/org.macosforge.xquartz:0
terminal-notifier -title "Insomnia" -message "Time to take a rest" -sound "default" -group rest -timeout 7 -appIcon sleep.png 2> ~/git/darwin.log
I found a way arround this by using reattach-user-to-namespace found in homebrew. When using at what happens is the command or file is ran with some weird permissions by using the tool above it ties you with ur current terminal namespace and therefore it has all the necessary permissions
Homebrew also let's you install at
@alexanderepstein: Can you post an example of how to successfully combine reattach-to-user-namespace
, terminal-notifier
and at
?
I thought I was discovering a brand new bug considering the lack of documentation for using notifications with at
, but I'm glad to see this issue!
The workaround suggested in https://github.com/julienXX/terminal-notifier/issues/144#issuecomment-311246686 seems to work.
@for-coursera @forthrin @annidy I'm adding a short example here, hope this helps.
brew install reattach-to-user-namespace
echo 'reattach-to-user-namespace terminal-notifier -title "Title" -message "Example message"' | at now + 1 minute
at
is getting more and more difficult to use with macOS. If anyone knows a simple solution to scheduling tasks that doesn't involve XML or while/sleep loops, post here.
Something like
echo 'terminal-notifier -title "TV" -message "Superman"' | sudo at 1305
produces just nothing... But may be there's some other way?(Or may be it's just me, and something like the above works for others just fine?)