View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

run IRAF job in background

ping zhao wrote on Feb 09, 2007

hello,

Is it possible to run IRAF job in background so even the window where the job is submitted is closed, the job is still running?

I want to log into another machine to start an IRAF job. But I need log out of that machine once the job is started.

Thanks,

Ping

Mike Fitzpatrick wrote on Feb 09, 2007

So long as all of the output is redirected this shouldn't be a problem normally. I'm assuming you're talking here about things like procedure scripts. One possible problem might be with a script that uses foreign commands: These are executed in a spawned shell and if your .cshrc file does something which expects a terminal (e.g. an 'stty' or 'tset' command belonging in our .login file) the script may die. Graphics from tasks can be redirected to a file using the ">G" convention or with a task 'device' parameter to save the metacode if needed, graphics input would require a cursor command file.

-Mike

ping zhao wrote on Feb 09, 2007

Hi Mike,

Thanks for your reply.

I want to run allstar in background. How should I do it?
Should I start iraf first, or run it on command line using
cl < script

Thanks,

Ping

Mike Fitzpatrick wrote on Feb 09, 2007

Be sure to turn off the 'verify' package param in DAOPHOT to suppress the prompts, after that something like

 da> allstar dev$ypix default default default default default >& out.txt & 


should run it in the background and you can log out. If you have a number of images, the a file of those commands (without the final '&') can be run as "cl < cmds >& cmd.out &" and should process each command in turn.

-Mike

ping zhao wrote on Feb 09, 2007

Hi Mike,

I just tried.

I can run it as
cl < script >& out

but that doesn't free the window.

If I run as

cl < script >& out &

it gives error

cl> BKG ERROR: new CL installed; logout and try again

I log out and made new iraf. The error is the same.

Thanks,

Ping

Mike Fitzpatrick wrote on Feb 09, 2007

Try making it a simple procedure script,i.e.


procedure doit()
begin
         .....your list of commands
end


declared as a task with "cl> task $doit = /path/doit.cl", the run as "cl> doit >& out &" That was why I asked about procedure scripts before, I remember something about history scripts and background tasks but don't remember the details.

-Mike

ping zhao wrote on Feb 09, 2007

Hi Mike,

I wrote a very simple script:

procedure doit()
begin
print 111111
end

I can run it as:

doit >& out

But once I add the final &, It dies with the error:

cl> BKG ERROR: new CL installed; logout and try again

Ping

Mike Fitzpatrick wrote on Feb 09, 2007

Using just the script you sent:


apphot> cd /tmp
apphot> vi doit.cl
   ....and I cut-n-paste your code....
apphot> task $doit = doit.cl
apphot> doit
111111 
apphot> doit >& out
apphot> doit >& out &
[1]
apphot> 
[1] done  0.0 0:00 0%


Check your 'uparm' directory, I'm wondering whether there's an old background file in there (i.e. beginning w/ 'bkg', just delete it).

-Mike

ping zhao wrote on Feb 09, 2007

Hi Mike,

I did exactly as you said. But as soon as I add the final &, it dies.
I deleted the bkg files in uparms. But it didn't help.

Ping

ping zhao wrote on Feb 09, 2007

Hi Mike,

I found the reason.

I started IRAF with "ncl". When I start is with cl, it works.

Thanks!

Ping

Last post on Feb 09, 2007