IDL job doesn't work from crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting IDL job doesn't work from crontab
# 1  
Old 02-20-2008
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  
Old 02-20-2008
When you are running a script from crontab, you should specify the absolute path along with each filename used in the script.
# 3  
Old 02-25-2008
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  
Old 12-24-2008
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  
Old 07-04-2009
For test:
Code:
*/1 * * * * username export DISPLAY=':0' && xhost local:username && xmessage "Running GUI application from cron"

It works for me, good luck.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Job runs manually, doesn't work in crontab

I have a script (/home/admin/run_bkup.sh) that I can run manually to kick off an executable job. I want to run it in crontab, but it doesn't work. Here's the script: shell=/bin/bash today=$(date +"%m-%d-%y") /opt/CPsuite-R77/fw1/bin/upgrade_tools/upgrade_export mgt-svr-bkup-$today << EOF y... (18 Replies)
Discussion started by: df08388
18 Replies

2. Shell Programming and Scripting

-ne 0 doesn't work -le does

Hi, I am using korn shell. until ] do echo "\$# = " $# echo "$1" shift done To the above script, I passed 2 parameters and the program control doesn't enter inside "until" loop. If I change it to until ] then it does work. Why numeric comparison is not working with -ne and works... (3 Replies)
Discussion started by: ab_2010
3 Replies

3. UNIX for Dummies Questions & Answers

Why doesn't this work?

find . -name "05_scripts" -type d -exec mv -f {}/'*.aep\ Logs' {}/.LogFiles \; Returns this failure: mv: rename ./019_0120_WS_WH_gate_insideTEST/05_scripts/*.aep\ Logs to ./019_0120_WS_WH_gate_insideTEST/05_scripts/.LogFiles/*.aep\ Logs: No such file or directory I don't know why it's trying... (4 Replies)
Discussion started by: scribling
4 Replies

4. Shell Programming and Scripting

if condition doesn't work

i want to get the value for column 4rth when i =4. please guide what i am doing wrong. thanks var=`cat file.csv` for i in $var; do { if ; then var4=$var4+$i fi echo $i } done I am geting this error message "0403-009 The specified number is not valid for this command." (8 Replies)
Discussion started by: sagii
8 Replies

5. UNIX for Advanced & Expert Users

remsh doesn't work

Hi, I need to use remsh inside a ksh script. The script would remsh to another machine (maybe different OS) and then execute commands. A Simple Script: #!/usr/bin/ksh remsh sun7656 -l myuser "cd /user.3/MyFolder; ls -lart" But this gives me the error: permission denied I also... (4 Replies)
Discussion started by: som.nitk
4 Replies

6. Shell Programming and Scripting

What to do when mtime doesn't work?

I have a folder that I need to search for new files and copy on the latest. I've been using "-mtime -1" in my command line but it doesn't seem to work. I've been meaning to fine a different script because files are dropped into the folder all day long and because of the -mtime, I've only be... (19 Replies)
Discussion started by: bbbngowc
19 Replies

7. Shell Programming and Scripting

Expect script doesn't work under crontab

Hi All, Using Expect script when I run it manually it works. But when I put the entry in crontab, the job is still running after 15 hours. The script was created as root. I don't think it's a permission issue. Any idea? This is what I have under root crontab... 00 18 * * 1-5... (4 Replies)
Discussion started by: samnyc
4 Replies

8. UNIX for Dummies Questions & Answers

my make doesn't work

hi I wrote the following makefile, I have just one problem, when i type make clean I get the message make 'clean' is up to date and any obj file is removed from my folder, what's wrong? Thank you CC = cc all: es.o elaboration.o $(CC) -o es es.o elaboration.o elaboration.o:... (0 Replies)
Discussion started by: Puntino
0 Replies

9. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

10. Shell Programming and Scripting

Why doesn't this work?

cat .servers | while read LINE; do ssh jason@$LINE $1 done exit 1 ./command.ksh "ls -l ~jason" Why does this ONLY iterate on the first server in the list? It's not doing the command on all the servers in the list, what am I missing? Thanks! JP (2 Replies)
Discussion started by: jpeery
2 Replies
Login or Register to Ask a Question