You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Terry Ofner <to...@comcast.net> on 2008/01/03 16:56:06 UTC

How to put batch process into background on Mac OS

This is not a huge matter. More on the line of an annoyance. And I  
may need to take this question to a java list rather than this list.  
If so, just point me in the right direction.

At any rate, I have an XSLT stylesheet that produces 50+ separate fo  
documents. I then run the shell script below to batch produce the pdf  
documents:

#!/bin/sh
for foo in *.fo
do
state=`basename $foo .fo`
/Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
done

When I run this script on my Mac (OS X 10.4.11, java version  
"1.5.0_13" fop-0.94), org.apache.fop.cli.main takes control of the  
desktop, stopping whatever it is I am doing for about 5 seconds. I  
gain control again for about 5 seconds until fop pumps out another  
pdf document. I basically have to step away from the computer for the  
8 minutes that the batch process takes. Adding & and wait to the main  
line of the script does not seem to work:

/Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
wait
done

The first script above on Ubuntu linux runs in the background without  
interrupting other running process.

Any simple solutions?

Terry Ofner

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to put batch process into background on Mac OS

Posted by Terry Ofner <to...@comcast.net>.
nice does not seem to change the outcome. It only changes the  
priority of the process. When it runs, it still places fop in the  
foreground. Here is what I have tried:

nice /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
nice -n 20 /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/ 
$state.pdf &

I have also added & at the command line:

./createPDF.sh &

Any other options?




On Jan 3, 2008, at 11:36 AM, Steve Quirk wrote:

>
> Use 'nice' to run it.  Alter the script so that the fop execution  
> looks like:
>
> nice /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>
> You can check the man page for nice for more info.
>
> Steve
>
> On Thu, 3 Jan 2008, Terry Ofner wrote:
>
>> This is not a huge matter. More on the line of an annoyance. And I  
>> may need to take this question to a java list rather than this  
>> list. If so, just point me in the right direction.
>>
>> At any rate, I have an XSLT stylesheet that produces 50+ separate  
>> fo documents. I then run the shell script below to batch produce  
>> the pdf documents:
>>
>> #!/bin/sh
>> for foo in *.fo
>> do
>> state=`basename $foo .fo`
>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>> done
>>
>> When I run this script on my Mac (OS X 10.4.11, java version  
>> "1.5.0_13" fop-0.94), org.apache.fop.cli.main takes control of the  
>> desktop, stopping whatever it is I am doing for about 5 seconds. I  
>> gain control again for about 5 seconds until fop pumps out another  
>> pdf document. I basically have to step away from the computer for  
>> the 8 minutes that the batch process takes. Adding & and wait to  
>> the main line of the script does not seem to work:
>>
>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
>> wait
>> done
>>
>> The first script above on Ubuntu linux runs in the background  
>> without interrupting other running process.
>>
>> Any simple solutions?
>>
>> Terry Ofner
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users- 
>> help@xmlgraphics.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to put batch process into background on Mac OS

Posted by Terry Ofner <to...@comcast.net>.
James,

Your suggestion works. I have no idea where the vm arguments are in  
the fop script. So I changed my script to invoke the jar directly,  
adding the headless argument. I had to move all the jar files in fop/ 
lib to the build directory to get this to work:

java -Djava.awt.headless=true -jar /Applications/fop-0.94/build/ 
fop.jar -fo $foo -pdf ../pdf_files/$state.pdf

Thanks for the tip.

Terry

On Jan 3, 2008, at 12:35 PM, James Howard wrote:

> Actually that probably won't do what you want.  Adding - 
> Djava.awt.headless=true to the vm arguments in the fop script  
> probably will work.
>
> On Jan 3, 2008, at 8:36 AM, Steve Quirk <sq...@ieee.org> wrote:
>
>>
>> Use 'nice' to run it.  Alter the script so that the fop execution  
>> looks like:
>>
>> nice /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>>
>> You can check the man page for nice for more info.
>>
>> Steve
>>
>> On Thu, 3 Jan 2008, Terry Ofner wrote:
>>
>>> This is not a huge matter. More on the line of an annoyance. And  
>>> I may need to take this question to a java list rather than this  
>>> list. If so, just point me in the right direction.
>>>
>>> At any rate, I have an XSLT stylesheet that produces 50+ separate  
>>> fo documents. I then run the shell script below to batch produce  
>>> the pdf documents:
>>>
>>> #!/bin/sh
>>> for foo in *.fo
>>> do
>>> state=`basename $foo .fo`
>>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>>> done
>>>
>>> When I run this script on my Mac (OS X 10.4.11, java version  
>>> "1.5.0_13" fop-0.94), org.apache.fop.cli.main takes control of  
>>> the desktop, stopping whatever it is I am doing for about 5  
>>> seconds. I gain control again for about 5 seconds until fop pumps  
>>> out another pdf document. I basically have to step away from the  
>>> computer for the 8 minutes that the batch process takes. Adding &  
>>> and wait to the main line of the script does not seem to work:
>>>
>>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
>>> wait
>>> done
>>>
>>> The first script above on Ubuntu linux runs in the background  
>>> without interrupting other running process.
>>>
>>> Any simple solutions?
>>>
>>> Terry Ofner
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users- 
>>> help@xmlgraphics.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users- 
>> help@xmlgraphics.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to put batch process into background on Mac OS

Posted by Terry Ofner <to...@comcast.net>.
Steve,

Yep. That works too. On 0.94 the fop_exec_command is near the bottom  
of the fop script and looks like this:

fop_exec_command="exec \"$JAVACMD\" -Djava.awt.headless=true  
$LOGCHOICE $LOGLEVEL -classpath \"$LOCALCLASSPATH\" $FOP_OPTS  
org.apache.fop.cli.Main $fop_exec_args"

Note: The -Djava.awt.headless=true was originally missing.

The only problem with changing the fop script is that it will only  
impact my installation. If I ever pass this process off to someone  
else (or update my version of fop), I will have to remember to change  
the exec command. I suppose that I would have to mess with something  
either way. (I would have to move all the jar files to the build  
directory.)

Either way, all is well now.

Thanks.

Terry




On Jan 3, 2008, at 1:14 PM, Steve Quirk wrote:

>
> I had looked at the fop script I had and saw it there.  I wasn't  
> sure that I had made the change or not.  In any case, if it's  
> helpful, it should look like:
>
> fop_exec_command="exec \"$JAVACMD\" ${ENDORSED} - 
> Djava.awt.headless=true $LOGCHOICE $LOGLEVEL -classpath  
> \"$LOCALCLASSPATH\" $FOP_OPTS org.apache.fop.cli.Main $fop_exec_args"
>
> (I'm using 0.93, so it might be slightly different).
>
> That should avoid any icons or desktop interaction.
>
> steve
>
> On Thu, 3 Jan 2008, James Howard wrote:
>
>> Actually that probably won't do what you want.  Adding - 
>> Djava.awt.headless=true to the vm arguments in the fop script  
>> probably will work.
>>
>> On Jan 3, 2008, at 8:36 AM, Steve Quirk <sq...@ieee.org> wrote:
>>
>>> Use 'nice' to run it.  Alter the script so that the fop execution  
>>> looks like:
>>> nice /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/ 
>>> $state.pdf
>>> You can check the man page for nice for more info.
>>> Steve
>>> On Thu, 3 Jan 2008, Terry Ofner wrote:
>>>> This is not a huge matter. More on the line of an annoyance. And  
>>>> I may need to take this question to a java list rather than this  
>>>> list. If so, just point me in the right direction.
>>>> At any rate, I have an XSLT stylesheet that produces 50+  
>>>> separate fo documents. I then run the shell script below to  
>>>> batch produce the pdf documents:
>>>> #!/bin/sh
>>>> for foo in *.fo
>>>> do
>>>> state=`basename $foo .fo`
>>>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>>>> done
>>>> When I run this script on my Mac (OS X 10.4.11, java version  
>>>> "1.5.0_13" fop-0.94), org.apache.fop.cli.main takes control of  
>>>> the desktop, stopping whatever it is I am doing for about 5  
>>>> seconds. I gain control again for about 5 seconds until fop  
>>>> pumps out another pdf document. I basically have to step away  
>>>> from the computer for the 8 minutes that the batch process  
>>>> takes. Adding & and wait to the main line of the script does not  
>>>> seem to work:
>>>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
>>>> wait
>>>> done
>>>> The first script above on Ubuntu linux runs in the background  
>>>> without interrupting other running process.
>>>> Any simple solutions?
>>>> Terry Ofner
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> To unsubscribe, e-mail: fop-users- 
>>>> unsubscribe@xmlgraphics.apache.org
>>>> For additional commands, e-mail: fop-users- 
>>>> help@xmlgraphics.apache.org
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users- 
>>> help@xmlgraphics.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users- 
>> help@xmlgraphics.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to put batch process into background on Mac OS

Posted by Steve Quirk <sq...@ieee.org>.
I had looked at the fop script I had and saw it there.  I wasn't sure that 
I had made the change or not.  In any case, if it's helpful, it should 
look like:

fop_exec_command="exec \"$JAVACMD\" ${ENDORSED} -Djava.awt.headless=true 
$LOGCHOICE $LOGLEVEL -classpath \"$LOCALCLASSPATH\" $FOP_OPTS 
org.apache.fop.cli.Main $fop_exec_args"

(I'm using 0.93, so it might be slightly different).

That should avoid any icons or desktop interaction.

steve

On Thu, 3 Jan 2008, James Howard wrote:

> Actually that probably won't do what you want.  Adding 
> -Djava.awt.headless=true to the vm arguments in the fop script probably will 
> work.
>
> On Jan 3, 2008, at 8:36 AM, Steve Quirk <sq...@ieee.org> wrote:
>
>> 
>> Use 'nice' to run it.  Alter the script so that the fop execution looks 
>> like:
>> 
>> nice /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>> 
>> You can check the man page for nice for more info.
>> 
>> Steve
>> 
>> On Thu, 3 Jan 2008, Terry Ofner wrote:
>> 
>>> This is not a huge matter. More on the line of an annoyance. And I may 
>>> need to take this question to a java list rather than this list. If so, 
>>> just point me in the right direction.
>>> 
>>> At any rate, I have an XSLT stylesheet that produces 50+ separate fo 
>>> documents. I then run the shell script below to batch produce the pdf 
>>> documents:
>>> 
>>> #!/bin/sh
>>> for foo in *.fo
>>> do
>>> state=`basename $foo .fo`
>>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>>> done
>>> 
>>> When I run this script on my Mac (OS X 10.4.11, java version "1.5.0_13" 
>>> fop-0.94), org.apache.fop.cli.main takes control of the desktop, stopping 
>>> whatever it is I am doing for about 5 seconds. I gain control again for 
>>> about 5 seconds until fop pumps out another pdf document. I basically have 
>>> to step away from the computer for the 8 minutes that the batch process 
>>> takes. Adding & and wait to the main line of the script does not seem to 
>>> work:
>>> 
>>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
>>> wait
>>> done
>>> 
>>> The first script above on Ubuntu linux runs in the background without 
>>> interrupting other running process.
>>> 
>>> Any simple solutions?
>>> 
>>> Terry Ofner
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>> 
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to put batch process into background on Mac OS

Posted by James Howard <ja...@mac.com>.
Actually that probably won't do what you want.  Adding - 
Djava.awt.headless=true to the vm arguments in the fop script probably  
will work.

On Jan 3, 2008, at 8:36 AM, Steve Quirk <sq...@ieee.org> wrote:

>
> Use 'nice' to run it.  Alter the script so that the fop execution  
> looks like:
>
> nice /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>
> You can check the man page for nice for more info.
>
> Steve
>
> On Thu, 3 Jan 2008, Terry Ofner wrote:
>
>> This is not a huge matter. More on the line of an annoyance. And I  
>> may need to take this question to a java list rather than this  
>> list. If so, just point me in the right direction.
>>
>> At any rate, I have an XSLT stylesheet that produces 50+ separate  
>> fo documents. I then run the shell script below to batch produce  
>> the pdf documents:
>>
>> #!/bin/sh
>> for foo in *.fo
>> do
>> state=`basename $foo .fo`
>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
>> done
>>
>> When I run this script on my Mac (OS X 10.4.11, java version  
>> "1.5.0_13" fop-0.94), org.apache.fop.cli.main takes control of the  
>> desktop, stopping whatever it is I am doing for about 5 seconds. I  
>> gain control again for about 5 seconds until fop pumps out another  
>> pdf document. I basically have to step away from the computer for  
>> the 8 minutes that the batch process takes. Adding & and wait to  
>> the main line of the script does not seem to work:
>>
>> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
>> wait
>> done
>>
>> The first script above on Ubuntu linux runs in the background  
>> without interrupting other running process.
>>
>> Any simple solutions?
>>
>> Terry Ofner
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users- 
>> help@xmlgraphics.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: How to put batch process into background on Mac OS

Posted by Steve Quirk <sq...@ieee.org>.
Use 'nice' to run it.  Alter the script so that the fop execution looks 
like:

nice /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf

You can check the man page for nice for more info.

Steve

On Thu, 3 Jan 2008, Terry Ofner wrote:

> This is not a huge matter. More on the line of an annoyance. And I may need 
> to take this question to a java list rather than this list. If so, just point 
> me in the right direction.
>
> At any rate, I have an XSLT stylesheet that produces 50+ separate fo 
> documents. I then run the shell script below to batch produce the pdf 
> documents:
>
> #!/bin/sh
> for foo in *.fo
> do
> state=`basename $foo .fo`
> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf
> done
>
> When I run this script on my Mac (OS X 10.4.11, java version "1.5.0_13" 
> fop-0.94), org.apache.fop.cli.main takes control of the desktop, stopping 
> whatever it is I am doing for about 5 seconds. I gain control again for about 
> 5 seconds until fop pumps out another pdf document. I basically have to step 
> away from the computer for the 8 minutes that the batch process takes. Adding 
> & and wait to the main line of the script does not seem to work:
>
> /Applications/fop-0.94/fop -fo $foo -pdf ../pdf_files/$state.pdf &
> wait
> done
>
> The first script above on Ubuntu linux runs in the background without 
> interrupting other running process.
>
> Any simple solutions?
>
> Terry Ofner
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org