[Novalug] nohup and chaining commands

James Ewing Cottrell 3rd JECottrell3 at Comcast.NET
Thu Oct 23 10:11:36 EDT 2008


[0] when cmd1 runs by itself, what is the mode of the file created?
[1] Why use nohup at all? Just background it!
[2a] try: nohup sh -c "umask 022; cmd1 --output=/path/to/file" &
[2b]  or: nohup sh -c "cmd1 --output=/path/to/file; chmod 666 
/path/to/file" &
[2c]  or: echo "cmd1 --output=/path/to/file; chmod 666 /path/to/file" | 
nohup sh &
[3] anything with parens has to be quoted
[4] nohup probably only understands simple commands
[5] rtfm on nohup very carefully

JIM

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 at calypso.tux.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
> 
> 
> ------------------------------------------------------------------------
> 
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.175 / Virus Database: 270.8.2/1740 - Release Date: 10/22/2008 7:24 PM
> 




More information about the Novalug mailing list