LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 11-21-2011, 12:05 AM   #1
r_jr
Member
 
Registered: Feb 2006
Distribution: Ubuntu
Posts: 65

Rep: Reputation: 0
Question cron alert message


I am not sure where to put this so I am posting the question here.

I am attempting to create a cron script to check the connection to a server using fping. Now this works, but I need to somehow alert the user on the gnome desktop. I tried using gxmessage, but the messagebox never pops up though it does work in a terminal. I was wondering how do I use gxmessage box or some other way to create an alert message as part of a cron script.
 
Old 11-21-2011, 12:21 AM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Have you tried using zenity? I run Fedora, and have successfully used zenity within cron a few times. Have a look here - http://linux.byexamples.com/archives...og-examples-2/

Cheers,

Josh
 
Old 11-21-2011, 03:46 AM   #3
D1ver
Member
 
Registered: Jan 2010
Distribution: Slackware 13.37
Posts: 527
Blog Entries: 3

Rep: Reputation: 126Reputation: 126
I'm not sure if this is related but I needed to add
Code:
export DISPLAY=:0.0
To get a script working as a cron job that used feh to change the background. Maybe gxmessage doesn't know which screen you're asking it to display on?
 
Old 11-21-2011, 05:44 PM   #4
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Quote:
Originally Posted by D1ver View Post
I'm not sure if this is related but I needed to add
Code:
export DISPLAY=:0.0
To get a script working as a cron job that used feh to change the background. Maybe gxmessage doesn't know which screen you're asking it to display on?
After thinking about it, that might be the issue. If running from a standard terminal, of course it wouldn't work, but exporting the DISPLAY environment would definitely tell it to use the first X server that is allocated on the OP's system.
 
Old 11-22-2011, 03:55 AM   #5
r_jr
Member
 
Registered: Feb 2006
Distribution: Ubuntu
Posts: 65

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by corp769 View Post
After thinking about it, that might be the issue. If running from a standard terminal, of course it wouldn't work, but exporting the DISPLAY environment would definitely tell it to use the first X server that is allocated on the OP's system.
Yes, that was it though you are wrong in that it did work from a standard terminal. It only did not work as a cron script. But after adding the export DISPlay:=0 && to my command, it now works. Thanks though.

 
Old 11-22-2011, 10:02 AM   #6
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Quote:
Originally Posted by r_jr View Post
Yes, that was it though you are wrong in that it did work from a standard terminal. It only did not work as a cron script. But after adding the export DISPlay:=0 && to my command, it now works. Thanks though.

I was talking about an actual terminal, and not a virtual terminal, like you would run gnome-terminal with X.
 
  


Reply

Tags
crontab, scheduler


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox alert message - Ubuntu 9.04 mumblemike Linux - Software 2 06-28-2009 08:55 PM
Quota alert via Wall for user via Cron snoopy1 Linux - Software 2 05-31-2009 08:49 PM
firefox alert message - Ubuntu 7.10 The_Cheat Linux - Newbie 2 01-14-2008 09:37 AM
Alert Message when someoe connect to a server. bijit1709 Programming 6 04-22-2007 11:26 AM


All times are GMT -5. The time now is 08:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration