How to use notify-send with crontab? [duplicate]












7















This question already has an answer here:




  • Notify-send doesn't work from crontab

    13 answers




I really read many tutorials, but crontab doesn't start notify send.



What I've tried:





  1. etc/crontab



    added at the end:



    15 * * * * notify-send 'crontab' 'test'



  2. with crontab interface:



    crontab -e


    added at the end:



    15 * * * * notify-send 'crontab' 'test'











share|improve this question















marked as duplicate by Jacob Vlijm, Eric Carvalho, Rinzwind, Byte Commander, Aaron Oct 8 '16 at 19:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 3




    Try to run .sh script by editing eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
    – d a i s y
    Oct 8 '16 at 7:23










  • @Lnux , Where do I place this line? On .sh file before the notify-send 'crontab' 'test' ?
    – Vitor Abella
    Oct 8 '16 at 7:44












  • yes in your bash script before notify-send
    – d a i s y
    Oct 8 '16 at 7:51










  • on 16.04 this one worked */1 * * * * eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";/usr/bin/notify-send -i appointment -c "im" "Keep Working"
    – KrIsHnA
    Jul 8 '18 at 5:56










  • * * * * * export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && DISPLAY=:0 notify-send "Foo bar"
    – Saeed Falsafin
    Dec 21 '18 at 15:03


















7















This question already has an answer here:




  • Notify-send doesn't work from crontab

    13 answers




I really read many tutorials, but crontab doesn't start notify send.



What I've tried:





  1. etc/crontab



    added at the end:



    15 * * * * notify-send 'crontab' 'test'



  2. with crontab interface:



    crontab -e


    added at the end:



    15 * * * * notify-send 'crontab' 'test'











share|improve this question















marked as duplicate by Jacob Vlijm, Eric Carvalho, Rinzwind, Byte Commander, Aaron Oct 8 '16 at 19:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 3




    Try to run .sh script by editing eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
    – d a i s y
    Oct 8 '16 at 7:23










  • @Lnux , Where do I place this line? On .sh file before the notify-send 'crontab' 'test' ?
    – Vitor Abella
    Oct 8 '16 at 7:44












  • yes in your bash script before notify-send
    – d a i s y
    Oct 8 '16 at 7:51










  • on 16.04 this one worked */1 * * * * eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";/usr/bin/notify-send -i appointment -c "im" "Keep Working"
    – KrIsHnA
    Jul 8 '18 at 5:56










  • * * * * * export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && DISPLAY=:0 notify-send "Foo bar"
    – Saeed Falsafin
    Dec 21 '18 at 15:03
















7












7








7


7






This question already has an answer here:




  • Notify-send doesn't work from crontab

    13 answers




I really read many tutorials, but crontab doesn't start notify send.



What I've tried:





  1. etc/crontab



    added at the end:



    15 * * * * notify-send 'crontab' 'test'



  2. with crontab interface:



    crontab -e


    added at the end:



    15 * * * * notify-send 'crontab' 'test'











share|improve this question
















This question already has an answer here:




  • Notify-send doesn't work from crontab

    13 answers




I really read many tutorials, but crontab doesn't start notify send.



What I've tried:





  1. etc/crontab



    added at the end:



    15 * * * * notify-send 'crontab' 'test'



  2. with crontab interface:



    crontab -e


    added at the end:



    15 * * * * notify-send 'crontab' 'test'






This question already has an answer here:




  • Notify-send doesn't work from crontab

    13 answers








cron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 8 '16 at 9:30









Jacob Vlijm

63.5k9123218




63.5k9123218










asked Oct 8 '16 at 6:21









Vitor Abella

2,709102762




2,709102762




marked as duplicate by Jacob Vlijm, Eric Carvalho, Rinzwind, Byte Commander, Aaron Oct 8 '16 at 19:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Jacob Vlijm, Eric Carvalho, Rinzwind, Byte Commander, Aaron Oct 8 '16 at 19:32


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 3




    Try to run .sh script by editing eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
    – d a i s y
    Oct 8 '16 at 7:23










  • @Lnux , Where do I place this line? On .sh file before the notify-send 'crontab' 'test' ?
    – Vitor Abella
    Oct 8 '16 at 7:44












  • yes in your bash script before notify-send
    – d a i s y
    Oct 8 '16 at 7:51










  • on 16.04 this one worked */1 * * * * eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";/usr/bin/notify-send -i appointment -c "im" "Keep Working"
    – KrIsHnA
    Jul 8 '18 at 5:56










  • * * * * * export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && DISPLAY=:0 notify-send "Foo bar"
    – Saeed Falsafin
    Dec 21 '18 at 15:03
















  • 3




    Try to run .sh script by editing eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
    – d a i s y
    Oct 8 '16 at 7:23










  • @Lnux , Where do I place this line? On .sh file before the notify-send 'crontab' 'test' ?
    – Vitor Abella
    Oct 8 '16 at 7:44












  • yes in your bash script before notify-send
    – d a i s y
    Oct 8 '16 at 7:51










  • on 16.04 this one worked */1 * * * * eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";/usr/bin/notify-send -i appointment -c "im" "Keep Working"
    – KrIsHnA
    Jul 8 '18 at 5:56










  • * * * * * export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && DISPLAY=:0 notify-send "Foo bar"
    – Saeed Falsafin
    Dec 21 '18 at 15:03










3




3




Try to run .sh script by editing eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
– d a i s y
Oct 8 '16 at 7:23




Try to run .sh script by editing eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
– d a i s y
Oct 8 '16 at 7:23












@Lnux , Where do I place this line? On .sh file before the notify-send 'crontab' 'test' ?
– Vitor Abella
Oct 8 '16 at 7:44






@Lnux , Where do I place this line? On .sh file before the notify-send 'crontab' 'test' ?
– Vitor Abella
Oct 8 '16 at 7:44














yes in your bash script before notify-send
– d a i s y
Oct 8 '16 at 7:51




yes in your bash script before notify-send
– d a i s y
Oct 8 '16 at 7:51












on 16.04 this one worked */1 * * * * eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";/usr/bin/notify-send -i appointment -c "im" "Keep Working"
– KrIsHnA
Jul 8 '18 at 5:56




on 16.04 this one worked */1 * * * * eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";/usr/bin/notify-send -i appointment -c "im" "Keep Working"
– KrIsHnA
Jul 8 '18 at 5:56












* * * * * export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && DISPLAY=:0 notify-send "Foo bar"
– Saeed Falsafin
Dec 21 '18 at 15:03






* * * * * export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && DISPLAY=:0 notify-send "Foo bar"
– Saeed Falsafin
Dec 21 '18 at 15:03












2 Answers
2






active

oldest

votes


















9














As suggested by @Lnux:



Create a .sh, for example test.sh:



#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";

#Code:
DISPLAY=:0 notify-send "Test"


Then set up crontab:



crontab -e


And at the bottom, add:



* * * * * /home/myUser/test.sh


Obs.: you can place your .sh file in another location and don't forget to allow executing it.






share|improve this answer





















  • In case it helps anyone else, I was able to replace the provided eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
    – pdoherty926
    Nov 9 '17 at 15:10



















3














Crontab is running in the background and without specified graphical output it will show nothing. So you should spicify, which output would you like to use. To achieve that, put export DISPLAY=:0 && before you command, e.g.



15 * * * * export DISPLAY=:0 && notify-send 'I am alive!'






share|improve this answer





















  • 'DISPLAY=:' or 'DISPLAY='
    – Vitor Abella
    Oct 8 '16 at 7:02










  • DISPLAY=:0 , the colon is neccessary.
    – Michal Polovka
    Oct 8 '16 at 7:08










  • I copied and pasted your code using ` crontab -e` using user and root and nothing happens...
    – Vitor Abella
    Oct 8 '16 at 7:14












  • well that is unexpected, because I did the same (except I changed 15 minutes to *) and it works. Try to change the DISPLAY variable to 1 or 2, I have seen it help sometimes, although I don't fully understand why.
    – Michal Polovka
    Oct 8 '16 at 7:20










  • Do you have to reboot to start?
    – Vitor Abella
    Oct 8 '16 at 7:25


















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









9














As suggested by @Lnux:



Create a .sh, for example test.sh:



#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";

#Code:
DISPLAY=:0 notify-send "Test"


Then set up crontab:



crontab -e


And at the bottom, add:



* * * * * /home/myUser/test.sh


Obs.: you can place your .sh file in another location and don't forget to allow executing it.






share|improve this answer





















  • In case it helps anyone else, I was able to replace the provided eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
    – pdoherty926
    Nov 9 '17 at 15:10
















9














As suggested by @Lnux:



Create a .sh, for example test.sh:



#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";

#Code:
DISPLAY=:0 notify-send "Test"


Then set up crontab:



crontab -e


And at the bottom, add:



* * * * * /home/myUser/test.sh


Obs.: you can place your .sh file in another location and don't forget to allow executing it.






share|improve this answer





















  • In case it helps anyone else, I was able to replace the provided eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
    – pdoherty926
    Nov 9 '17 at 15:10














9












9








9






As suggested by @Lnux:



Create a .sh, for example test.sh:



#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";

#Code:
DISPLAY=:0 notify-send "Test"


Then set up crontab:



crontab -e


And at the bottom, add:



* * * * * /home/myUser/test.sh


Obs.: you can place your .sh file in another location and don't forget to allow executing it.






share|improve this answer












As suggested by @Lnux:



Create a .sh, for example test.sh:



#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";

#Code:
DISPLAY=:0 notify-send "Test"


Then set up crontab:



crontab -e


And at the bottom, add:



* * * * * /home/myUser/test.sh


Obs.: you can place your .sh file in another location and don't forget to allow executing it.







share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 8 '16 at 8:11









Vitor Abella

2,709102762




2,709102762












  • In case it helps anyone else, I was able to replace the provided eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
    – pdoherty926
    Nov 9 '17 at 15:10


















  • In case it helps anyone else, I was able to replace the provided eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
    – pdoherty926
    Nov 9 '17 at 15:10
















In case it helps anyone else, I was able to replace the provided eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
– pdoherty926
Nov 9 '17 at 15:10




In case it helps anyone else, I was able to replace the provided eval ... with: eval "export | egrep 'DBUS_SESSION_BUS_ADDRESS|DISPLAY'".
– pdoherty926
Nov 9 '17 at 15:10













3














Crontab is running in the background and without specified graphical output it will show nothing. So you should spicify, which output would you like to use. To achieve that, put export DISPLAY=:0 && before you command, e.g.



15 * * * * export DISPLAY=:0 && notify-send 'I am alive!'






share|improve this answer





















  • 'DISPLAY=:' or 'DISPLAY='
    – Vitor Abella
    Oct 8 '16 at 7:02










  • DISPLAY=:0 , the colon is neccessary.
    – Michal Polovka
    Oct 8 '16 at 7:08










  • I copied and pasted your code using ` crontab -e` using user and root and nothing happens...
    – Vitor Abella
    Oct 8 '16 at 7:14












  • well that is unexpected, because I did the same (except I changed 15 minutes to *) and it works. Try to change the DISPLAY variable to 1 or 2, I have seen it help sometimes, although I don't fully understand why.
    – Michal Polovka
    Oct 8 '16 at 7:20










  • Do you have to reboot to start?
    – Vitor Abella
    Oct 8 '16 at 7:25
















3














Crontab is running in the background and without specified graphical output it will show nothing. So you should spicify, which output would you like to use. To achieve that, put export DISPLAY=:0 && before you command, e.g.



15 * * * * export DISPLAY=:0 && notify-send 'I am alive!'






share|improve this answer





















  • 'DISPLAY=:' or 'DISPLAY='
    – Vitor Abella
    Oct 8 '16 at 7:02










  • DISPLAY=:0 , the colon is neccessary.
    – Michal Polovka
    Oct 8 '16 at 7:08










  • I copied and pasted your code using ` crontab -e` using user and root and nothing happens...
    – Vitor Abella
    Oct 8 '16 at 7:14












  • well that is unexpected, because I did the same (except I changed 15 minutes to *) and it works. Try to change the DISPLAY variable to 1 or 2, I have seen it help sometimes, although I don't fully understand why.
    – Michal Polovka
    Oct 8 '16 at 7:20










  • Do you have to reboot to start?
    – Vitor Abella
    Oct 8 '16 at 7:25














3












3








3






Crontab is running in the background and without specified graphical output it will show nothing. So you should spicify, which output would you like to use. To achieve that, put export DISPLAY=:0 && before you command, e.g.



15 * * * * export DISPLAY=:0 && notify-send 'I am alive!'






share|improve this answer












Crontab is running in the background and without specified graphical output it will show nothing. So you should spicify, which output would you like to use. To achieve that, put export DISPLAY=:0 && before you command, e.g.



15 * * * * export DISPLAY=:0 && notify-send 'I am alive!'







share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 8 '16 at 6:53









Michal Polovka

1,1551819




1,1551819












  • 'DISPLAY=:' or 'DISPLAY='
    – Vitor Abella
    Oct 8 '16 at 7:02










  • DISPLAY=:0 , the colon is neccessary.
    – Michal Polovka
    Oct 8 '16 at 7:08










  • I copied and pasted your code using ` crontab -e` using user and root and nothing happens...
    – Vitor Abella
    Oct 8 '16 at 7:14












  • well that is unexpected, because I did the same (except I changed 15 minutes to *) and it works. Try to change the DISPLAY variable to 1 or 2, I have seen it help sometimes, although I don't fully understand why.
    – Michal Polovka
    Oct 8 '16 at 7:20










  • Do you have to reboot to start?
    – Vitor Abella
    Oct 8 '16 at 7:25


















  • 'DISPLAY=:' or 'DISPLAY='
    – Vitor Abella
    Oct 8 '16 at 7:02










  • DISPLAY=:0 , the colon is neccessary.
    – Michal Polovka
    Oct 8 '16 at 7:08










  • I copied and pasted your code using ` crontab -e` using user and root and nothing happens...
    – Vitor Abella
    Oct 8 '16 at 7:14












  • well that is unexpected, because I did the same (except I changed 15 minutes to *) and it works. Try to change the DISPLAY variable to 1 or 2, I have seen it help sometimes, although I don't fully understand why.
    – Michal Polovka
    Oct 8 '16 at 7:20










  • Do you have to reboot to start?
    – Vitor Abella
    Oct 8 '16 at 7:25
















'DISPLAY=:' or 'DISPLAY='
– Vitor Abella
Oct 8 '16 at 7:02




'DISPLAY=:' or 'DISPLAY='
– Vitor Abella
Oct 8 '16 at 7:02












DISPLAY=:0 , the colon is neccessary.
– Michal Polovka
Oct 8 '16 at 7:08




DISPLAY=:0 , the colon is neccessary.
– Michal Polovka
Oct 8 '16 at 7:08












I copied and pasted your code using ` crontab -e` using user and root and nothing happens...
– Vitor Abella
Oct 8 '16 at 7:14






I copied and pasted your code using ` crontab -e` using user and root and nothing happens...
– Vitor Abella
Oct 8 '16 at 7:14














well that is unexpected, because I did the same (except I changed 15 minutes to *) and it works. Try to change the DISPLAY variable to 1 or 2, I have seen it help sometimes, although I don't fully understand why.
– Michal Polovka
Oct 8 '16 at 7:20




well that is unexpected, because I did the same (except I changed 15 minutes to *) and it works. Try to change the DISPLAY variable to 1 or 2, I have seen it help sometimes, although I don't fully understand why.
– Michal Polovka
Oct 8 '16 at 7:20












Do you have to reboot to start?
– Vitor Abella
Oct 8 '16 at 7:25




Do you have to reboot to start?
– Vitor Abella
Oct 8 '16 at 7:25



Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

張江高科駅