The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Come and work for me! (UK) TonyChapman Linux 2 03-25-2008 05:08 AM
Script doesn't work, but commands inside work cheongww UNIX for Dummies Questions & Answers 2 11-14-2006 10:52 PM
ssh, cd to a dir, and and then do some work. tphyahoo Shell Programming and Scripting 1 04-13-2006 12:21 PM
how does this work??? ldpathak UNIX for Advanced & Expert Users 1 02-08-2006 10:05 AM
crontab -e dosent work dozy UNIX for Dummies Questions & Answers 11 05-26-2003 06:59 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-20-2008
SharkM SharkM is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 7
IDL job doesn't work from crontab

I have made a script to execute an IDL routine with the purpose to plot data on a fixed time.

The problem is that when I include this script in the crontab to run it every night, the IDL part doesn't work (the other commands, like getting data from the database, are carried out though).

This is what it looks like:

Relevant part of the script
set idl_latest = latest.dat
foreach location ("001" "002" "003" "004")

echo $date >> $idl_latest
echo $stn >> $idl_latest

setenv IDL_STARTUP plot_day_latest
/usr/local/bin/idl
unsetenv IDL_STARTUP
convert -format jpeg -quality 100 plot_day_latest.eps plot_day_latest.jpg
set filename = "plot_day_latest_"$location".jpg"
mv plot_day_latest.jpg $filename
endif

The 'plot_day_latest' script
openr,1,'latest.dat'
datum=""
station=""
readf,1,dat
readf,1,loc
close,1

plot_day,dat,loc
retall
exit


Finally, the IDL routine plot_day.pro expects a date (dat) and location (loc) and subsequently reads the right files for plotting. Anybody knows what is going wrong? The script works fine when I run it manually, but not from cron.
  #2 (permalink)  
Old 02-20-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
When you are running a script from crontab, you should specify the absolute path along with each filename used in the script.
  #3 (permalink)  
Old 02-25-2008
SharkM SharkM is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 7
Thank you for your comment, manikantants, but it doesn't work either with the absolute paths specified. Now, I have logged the crontab output during one run. These are the errors generated when calling the IDL routine in the script and running it from the crontab:

% Compiled module: PLOT_TEST.
% Compiled module: LOADCT.
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

% WINDOW: Unable to connect to X Windows display: :0.0
% WINDOW: Unable to open X Windows display.
Is your DISPLAY environment variable set correctly?
% Error occurred at: LOADCT 106 /d/appl/rsi/idl64/lib/loadct.pro
% PLOT_DAY 8
/usr/people/.........../plot_test.pro
% $MAIN$
% Execution halted at: PLOT_TEST 8

Please, can anybody tell me which settings I should change?

Last edited by SharkM; 02-26-2008 at 03:18 AM..
  #4 (permalink)  
Old 12-24-2008
caicainancy caicainancy is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 1
this is my solution:

1. for example , i have a idl runable program that is named ama, the path is /usr/local/itt/ama/

2. i create a file that is named cron.ama under /etc/

3. $ vi /etc/cron.ama,
# run ama at 12:30 everyday
30 12 * * * cd /usr/local/itt/ama/;./ama

4. $ crontab /etc/cron.ama

5. this all, you can use ps -ef to find the ama process at 12:30 , and work nomally until you kill it.

ps : $ crontab -e edit crontab
$ crontab -r rm cron which you add

Good Luck!

-------------------------------------------------------------------------------------
CHINESE HOT DRAGON
-------------------------------------------------------------------------------------
  #5 (permalink)  
Old 07-04-2009
joojoo joojoo is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 1
For test:

Code:
*/1 * * * * username export DISPLAY=':0' && xhost local:username && xmessage "Running GUI application from cron"

It works for me, good luck.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0