Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ ? on Running a Cron Job

Posted by: a31modela Oct 23 2006, 04:26 PM

Hello All,

I am trying to run a cron job that will restart an application every morning @ 5:10 on SuSE 8. The script runs fine from a non x window command line. The 1st thing the script is supposed to do is pop up an xmessage about the pending restart of the app. i am runing the script as root & the XWin is running as a specific user account. My script has the following in it at the top :
export DISPLAY=`hostname -i|cut -d " " -f 1`:0.0


xmessage -center " Terminal needs to reboot & will reboot in 5 minutes " -timeou
t 300 -buttons OK:1,CANCEL:2
ANS=$?

The entire script works as written when run from the command line as root BUT if running as root from cron.d it never shows the xmessage, just starts the recycle of the application.

Is there any way that I can have this job run as a cron job & export the Display as needed?

Thanks
Steve

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)