[SOLVED] cron do not sent notify

Forum rules
Before you post please read how to get help
User avatar
asobczak
Level 1
Level 1
Posts: 33
Joined: Sun Jun 10, 2012 5:32 pm
Location: Warsaw, Poland

[SOLVED] cron do not sent notify

Postby asobczak » Mon Jan 14, 2013 8:48 pm

I tried to find out the reason but failed.
The following line in cron table do not send notification.

00 * * * * notify-send "this is notification"

I want to have a script that send me notification at time intervals so it seams to be obvious way to do it by notify-send. But it is not working.
My configuration is in a signature.
I believe solution is simple.......
Last edited by asobczak on Tue Jan 15, 2013 4:51 am, edited 1 time in total.
Sys 1: Intel® Sandybridge Desktop 64b Intel® Core™ i3-2120 CPU @ 3.30GHz×4 MEM 3,8GiB
Kernel: 3.13.0-24-generic x86_64bit Cinnamon 2.8.6 Linux Mint 17.3 Rosa

Sys 2: ASUSTeK 1225B
Kernel: 3.13.0-37-generic x86_64bit Cinnamon 2.8.6 Linux Mint 17.3 Rosa

User avatar
Pilosopong Tasyo
Level 6
Level 6
Posts: 1363
Joined: Mon Jun 22, 2009 3:26 am
Location: Philippines

Re: cron do not sent notify

Postby Pilosopong Tasyo » Tue Jan 15, 2013 3:48 am

In lieu of

Code: Select all

00 * * * * notify-send "this is notification"

use

Code: Select all

00 * * * * DISPLAY=:0.0 notify-send "this is notification"

To run a GUI application in cron, it needs to know the display number. That what DISPLAY= is for. Normally, whoever is logged in the GUI first defaults to :0.0. Another concurrent user gets assigned :1.0.

You can find out the display number via Terminal:

Code: Select all

echo $DISPLAY

For more information, enter the following in Terminal:

Code: Select all

man X
Image
o Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime!
o If an issue has been fixed, please edit your first post and add the word [SOLVED].

User avatar
asobczak
Level 1
Level 1
Posts: 33
Joined: Sun Jun 10, 2012 5:32 pm
Location: Warsaw, Poland

Re: [SOLVED] cron do not sent notify

Postby asobczak » Tue Jan 15, 2013 4:53 am

@Pilosopong Tasyo
Thanks a lot. It does the job.
Well, none of "crontab explained" explain DISPLAY....
Sys 1: Intel® Sandybridge Desktop 64b Intel® Core™ i3-2120 CPU @ 3.30GHz×4 MEM 3,8GiB
Kernel: 3.13.0-24-generic x86_64bit Cinnamon 2.8.6 Linux Mint 17.3 Rosa

Sys 2: ASUSTeK 1225B
Kernel: 3.13.0-37-generic x86_64bit Cinnamon 2.8.6 Linux Mint 17.3 Rosa


Return to “Scripts & Bash”

Who is online

Users browsing this forum: No registered users and 1 guest