Thursday, January 1, 2015

[LINUX_Newbies] Notify-send and Cron jobs”

 

hello trying to setup a message to pop on the terminal or the gui that says "time to reset" 

I used this command to tell me my current tty 
ubuntuadmin@ubuntu:~$ tty
/dev/pts/1 (I tried the rest of them just incase)

I went here to see the location of the terminals
ubuntuadmin@ubuntu:~$ cd /dev/pts
ubuntuadmin@ubuntu:/dev/pts$ ls
0 1 2 3 ptmx

I went here to check syslog errors, no errors in the syslog file
root@ubuntu:~# grep CRON /var/log/syslog
Jan 1 15:06:01 ubuntu CRON[12616]: (ubuntuadmin) CMD (/home/ubuntuadmin notify-send "its time" >sudo/dev/pts/1 2>&1)

I also did a restart just incase 
ubuntuadmin@ubuntu:/dev/pts$ sudo service rsyslog restart
rsyslog stop/waiting
rsyslog start/running, process 12960

I used this command to clear the log
root@ubuntu:~# > /var/log/syslog

I tried this method as well, from this link 


this link says the notify-send will not work this way in cron point it to a script 
http://kernelcraft.wordpress.com/2011/11/27/notify-send-and-cron-jobs/
this is the method he used with a script
*/40 * * * * DISPLAY=:0.0 /home/your home folder/scripts/bash/url_monitor.sh 2>&1 

I tried this but that way not working either, 
I used the command below for display 
ubuntuadmin@ubuntu:/dev/pts$ echo $DISPLAY
:0

*/40 * * * * DISPLAY=:0.0 /home/ubuntuadmin/scripts bash my_script > /dev/pts/1 2>&1 (using */1 for now for testing so it should pop right away) 

my_script sitting in /home/ubuntuadmin/scripts
#!/bin/bash
# time

while [ 1 ]; do
notify-send "up time" "'uptime'"
sleep 1m
done

when I run bash my_script from /home/ubuntuadmin/scripts I get the notification. I copied bash from bin/bash to /home/ubuntuadmin/scripts

ubuntuadmin@ubuntu:~/scripts$ grep CRON /var/log/syslog
Jan 1 17:49:01 ubuntu CRON[14079]: (ubuntuadmin) CMD (DISPLAY=:0.0 /home/ubuntuadmin/scripts bash my_script > /dev/pts/1 2>&1)

any ideas on what I should try next to troubleshoot/fix? 


__._,_.___

Posted by: neilsmith1357@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.

.

__,_._,___

No comments:

Post a Comment