LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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-20-2011, 11:05 PM   #1
r_jr
Member
 
Registered: Feb 2006
Distribution: Ubuntu
Posts: 66

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-20-2011, 11:21 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 02:46 AM   #3
D1ver
Member
 
Registered: Jan 2010
Distribution: Slackware 13.37
Posts: 598
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
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, 04:44 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 02:55 AM   #5
r_jr
Member
 
Registered: Feb 2006
Distribution: Ubuntu
Posts: 66

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, 09:02 AM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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



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 07:55 PM
Quota alert via Wall for user via Cron snoopy1 Linux - Software 2 05-31-2009 07:49 PM
firefox alert message - Ubuntu 7.10 The_Cheat Linux - Newbie 2 01-14-2008 08:37 AM
Alert Message when someoe connect to a server. bijit1709 Programming 6 04-22-2007 10:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:21 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
Open Source Consulting | Domain Registration