running a batch of jython scripts

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

running a batch of jython scripts

Post by joleenf »

Hi,

I am having no problems running a jython script from a cron

The call in the cron is:

Code: Select all

sh /home/user/mcidas/scripts/runJython.sh /home/user/mcidas/scripts/reportAreaDiag.py -gEASTL -dCONUS


where runJython.sh contains

Code: Select all

#!/usr/bin/sh

# set the environment
. $HOME/.bashrc
cd $HOME/mcidas/scripts/

java -mx3000m -Dj3d.debug=true -Dpython.home=${hh} -cp ${CLASSPATH} org.python.util.jython $1 $2 $3 $4 $5 $6 $7



and in my .bashrc

Code: Select all

export mcvsys=$HOME/McIDAS-V-System
export mcvdoc=$HOME/McIDAS-V
export hh=${mcvdoc}/jython2.5.2
export mcvscr=$HOME/mcidas/scripts
export CLASSPATH=${mcvsys}/visad.jar:${mcvsys}/external.jar:${mcvsys}/jython.jar:${mcvsys}/commons-math-2.2.jar:${mcvsys}/mcidasv.jar


However, I have not figured out how nohup a series of jython scripts, or run them sequentially from a cron.

Right now, I can run in the foreground a file which contains the following lines.

Code: Select all

java -mx3000m -Dj3d.debug=true -Dpython.home=${hh} -cp ${CLASSPATH} org.python.util.jython /home/user/mcidas/scripts/reportAreaDiagTimeSpecGeoArc.py -g AGOES13 -d CONUS -t 2:45:00 -p 2:32:00 -j 2013072 -k 2013072
java -mx3000m -Dj3d.debug=true -Dpython.home=${hh} -cp ${CLASSPATH} org.python.util.jython /home/user/mcidas/scripts/reportAreaDiagTimeSpecGeoArc.py -g AGOES13 -d CONUS -t 3:15:00 -p 2:45:00 -j 2013072 -k 2013072
java -mx3000m -Dj3d.debug=true -Dpython.home=${hh} -cp ${CLASSPATH} org.python.util.jython /home/user/mcidas/scripts/reportAreaDiagTimeSpecGeoArc.py -g AGOES13 -d CONUS -t 3:32:00 -p 3:15:00 -j 2013072 -k 2013072


I cannot run in background or with a nohup. Is there a way to do this?

Joleen
User avatar
mhiley
Posts: 90
Joined: Mon Jan 23, 2012 10:22 pm

Re: running a batch of jython scripts

Post by mhiley »

Hi Joleen,
I'm curious how it fails when you run in background/nohup. Do you see an error message?
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: running a batch of jython scripts

Post by joleenf »

I was told that "screen" will do the job better than nohup. As I understand it, screen will set up a virtual window that allows the process to run even if a pipe is broken. The screen can be attached or detached and the process will continue to run.

Joleen
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: running a batch of jython scripts

Post by joleenf »

Hi Mike,

Yes. The process would stop automatically.

Joleen
Post Reply