Doesn't work when used within proces runner such as PM2 or CRONtab?
See original GitHub issueI’ve added script to my crontab somewhat like this:
@reboot /path/to/script
* * * * * /path/to/script
code runs, however there is no notification.
return notifier.notify({
title: 'foo',
message: randomMessage(),
})
Same issue with PM2. So it appears that when it’s being ran by some different process, not from user’s shell, then it fails to send notification to desktop.
Same issue when using with gnome-session-properties
. Linked SO question: https://stackoverflow.com/questions/49221716/when-using-notify-send-inside-some-process-runner-such-as-cron-or-pm2-notificat
Versions: Ubuntu 16.04 Gnome3 (gubuntu distro). notify-send 0.7.6 “node-notifier”: “^5.2.1”,
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
When using notify-send inside some process runner such as ...
It works when script is ran from user's CLI, but if I run this code via CRON ( crontab -e ) or PM2...
Read more >PM2: Run cron-job from single process in cluster mode
So this works fine if we run the code in fork mode (single process). But the problem occurs when we run the project...
Read more >A Complete Guide to Node.js Process Management with PM2
PM2 is a Node.js process manager that comes with a built-in load balancer. ... To list your running applications, use the pm2 list...
Read more >How to Deploy, Manage and Scale Node.js Apps with PM2
PM2 is an open-source process manager for Node.js applications that allows you to monitor and manage your application's lifecycle in ...
Read more >Quick Start - PM2
Advanced process manager for production Node.js applications. Load balancer, logs facility, startup script, micro service management, at a glance.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m trying to send notifications from cron, and the notifications don’t display under ubuntu 19.04. It does work under task scheduler on windows 10, though (using the exact same scripts).
Trying to run
notify-send
in general from cron does not work properly, but I found a this on SO which makes it work correctly from cron* * * * * XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send Hey "this is dog!
So in my .sh script I’ve added
export XDG_RUNTIME_DIR=/run/user/$(id -u)
to the top of it, and that has made it work from cron for linux.Related to #333