[Novalug] nohup and chaining commands

Bud Roth junk@taiotoshi.org
Thu Oct 23 08:55:40 EDT 2008


I experimented with the below, which seems to answer the mail for you,
if you adjust the commands:

>> cat t.sh
#!/bin/sh
touch t && chmod 666 t && cp -p t tt
>> ./t.sh &

Basically, I put the commands into a file.  (The shell script worked
without the shebang (#!/bin/sh), but I put it in anyway.)  Then, run the
script in background and you should be good to go.  Everything runs in
background instead of just the first command, but you get them running
sequentially, which would appear to be what you want.

Hope that helps...

Regards,

Bud Roth


On Thu, 2008-10-23 at 08:21 -0400, Jon Taimanglo wrote:
> I want to chain together multiple commands.  The first command usually
> takes a while to run and I usually background it:
> 
> nohup cmd1 &
> 
> The problem ends up being that when the file is created from this
> command the permissions are set as 600.  I want to chmod the file when
> cmd1 (cmd1 allows me to name the output file as an argument) is done
> then cp it to a shared directory (however, I can cp then chmod - as
> long as cmd1 has completed).
> 
> What is the proper format for chaining these commands?  I want to be
> able to fire this off at the command line and close my putty session
> and know that when cmd1 is done, someone else with access to the
> shared directory can view the output.
> 
> I don't think the following would work, but would like to know what
> would.
> 
> nohup cmd1 &; chmod 600 <outputfilefrom cmd1>; cp -p <outputfilefrom
> cmd1> /shared/dir
> 
> Thanks.
> 
> Jon
> 
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://lists.firemountain.net/pipermail/novalug/attachments/20081023/cd4199c4/attachment.asc>


More information about the Novalug mailing list