[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unoconv listener in an automake file?
From: |
Alan D. Salewski |
Subject: |
Re: unoconv listener in an automake file? |
Date: |
Sun, 14 Aug 2011 09:32:56 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Sun, Aug 14, 2011 at 02:30:01AM -0500, Paul Elliott spake thus:
> On Saturday, August 13, 2011 10:36:28 AM Alan D. Salewski wrote:
> > Hi Paul,
*snip*
> > convert-docs:
> > unoconv --listener & \
> > ucpid=$! ;\
edit: ucpid=$$! ;\
> > unoconv -f pdf some-document.odt && \
> > unoconv -f doc other-document.odt && \
> > unoconv -f jpg some-image.png && \
> > unoconv -f xsl some-spreadsheet.csv ;\
> > kill -15 $ucpid
edit: kill -15 $$ucpid
> Here is what I did:
> #tricky code alert
> #in a subshell save pid of subshell, ($$$$) becomes $$ in subshell.
> #then exec the listener. result is listnener running
> #in background with saved pid.
> echo "echo "'$$$$'" >address@hidden ; exec unoconv --listener" |
> $(SHELL) &
>
> #A bunch of unoconv commmands here
>
> #kill the saved pid, i.e. the listener. $$ becomes $ in the shell.
> -kill $$(<address@hidden)
> #remove the pid save file
> -rm address@hidden
>
> The shell you are using must support $$, ';' and exec for this to work.
> It this better or worse?
IMHO, worse. That's the approach I described as "gross" (see below),
with added complexity and resource use of an extra unneeded shell
process heaped on top:
> > One could store the pid value of the backgrounded 'unconv --listener'
> > process to a file, but since that's gross in this context I won't say
> > anything more about now that I've menioned that it's possible.
-Al
--
-----------------------------------------------------------------
a l a n d. s a l e w s k i address@hidden
1024D/FA2C3588 EDFA 195F EDF1 0933 1002 6396 7C92 5CB3 FA2C 3588
-----------------------------------------------------------------