comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Running IDL from cron
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Running IDL from cron [message #23859 is a reply to message #23857] Thu, 22 February 2001 11:57 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Gwyn Fireman wrote:
> How do you run IDL routines from cron - while maintaining IDL_PATH and
> other environment variables?
>
> I have had no trouble running my idl routines using batch or at, when
> starting in the same directory as the main-level routine. In that case
> my environment is copied to the spawned process.
>
> Now I have the need to run these from cron. I have been able to write
> scripts to cd to the appropriate directory and to run my .cshrc (where
> my IDL_PATH and other environment variables are defined), but keep
> running into problems. The latest is than .cshrc bombs on a
> system-level env that apparently isn't defined when running from cron.

Craig has given you a good start in a previous post. The other item
which often causes problems when running IDL via cron is that you can't
use graphics windows (unless you are prepared to leave a login session
running all the time).

The solution is to use the Z-buffer, which allows you to emulate the
functionality of an 8-bit graphics window. Let's say you want to call
this procedure (myplot.pro):

;---
PRO MYPLOT, X
plot, x
END
;---

You'll need an IDL script which sets up the Z-buffer, calls the
procedure, and saves the resulting image (script.pro):

;---
;- Set up Z buffer for 8-bit graphics
set_plot, 'Z'
device, z_buffering=0, set_resolution=[640, 480], $
set_colors=256, set_character_size=[10, 12]

;- Run my plotting procedure
myplot, findgen(10)

;- Save the result to a GIF file
tvlct, r, g, b, /get
write_gif, 'myplot.gif', tvrd(), r, g, b

;- Exit IDL
exit
;---

Finally, you need a shell script to configure and run IDL (script.csh):

#---
#!/bin/csh
cd $HOME/myplot
source /usr/local/rsi/idl/bin/idl_setup
setenv IDL_PATH ${IDL_PATH}:+\${IDL_DIR}/user_contrib/jhu_apl
setenv IDL_STARTUP
idl script.pro >& script.out
#---

Make sure the shell script has execute permission, and you're done. Test
the script to make sure it works:

% ./script.csh

and you should get the following output in script.out:

IDL Version 5.3 (IRIX mipseb). (c) 1999, Research Systems, Inc.
Installation number: 13221.
Licensed for use by: Space Science & Engineering Cntr, Univ of WI

% Compiled module: MYPLOT.
% Compiled module: WRITE_GIF.
% Loaded DLM: GIF.

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Repeats and Triangulation
Next Topic: Re: significant figures function?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:56:29 PDT 2025

Total time taken to generate the page: 0.00458 seconds