[SOLVED] cron do not sent notify

Forum rules
Before you post please read this

[SOLVED] cron do not sent notify

Postby asobczak on 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.
Intel® Sandybridge Desktop 64b Intel® Core™ i3-2120 CPU @ 3.30GHz × 4 MEM 3,8 GiB
Kernel 3.10-2-amd64 x86_64 (64 bit) Distro Linux Mint Debian Edition
Distribution : Linux Mint Debian Edition
User avatar
asobczak
Level 1
Level 1
 
Posts: 30
Joined: Sun Jun 10, 2012 5:32 pm
Location: Warsaw, Poland

Linux Mint is funded by ads and donations.
 

Re: cron do not sent notify

Postby Pilosopong Tasyo on 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
Pilosopong Tasyo
Level 6
Level 6
 
Posts: 1176
Joined: Mon Jun 22, 2009 3:26 am
Location: Philippines

Re: [SOLVED] cron do not sent notify

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

@Pilosopong Tasyo
Thanks a lot. It does the job.
Well, none of "crontab explained" explain DISPLAY....
Intel® Sandybridge Desktop 64b Intel® Core™ i3-2120 CPU @ 3.30GHz × 4 MEM 3,8 GiB
Kernel 3.10-2-amd64 x86_64 (64 bit) Distro Linux Mint Debian Edition
Distribution : Linux Mint Debian Edition
User avatar
asobczak
Level 1
Level 1
 
Posts: 30
Joined: Sun Jun 10, 2012 5:32 pm
Location: Warsaw, Poland


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 1 guest