[Novalug] nohup and chaining commands
Jon Taimanglo
jontaimanglo at gmail.com
Thu Oct 23 09:42:32 EDT 2008
Also, I tried it without the "("'s and got the following error:
syntax error near unexpected token `;'
On Thu, Oct 23, 2008 at 9:38 AM, Jon Taimanglo <jontaimanglo at gmail.com>wrote:
> cmd1 actually creates the file (the output file name is given as an
> argument). I should have stated earlier that cmd1 will throw and error if
> the file already exists and exit out. Also, I can remove the need to cp the
> file to a directory as I can just specify the /path/to/dir/for/file as an
> argument as well.
>
> However, when I tried:
>
> nohup (cmd1 --output=/path/to/file &; chmod 666 /path/to/file)
>
> I get a syntax error near unexpected token `cmd1`
>
>
>
> On Thu, Oct 23, 2008 at 9:25 AM, Ken Kauffman <kkauffman at headfog.com>wrote:
>
>> Is there a reason you aren't doing this:
>>
>> nohup cmd1 > /shared/dir/[file] &
>>
>> You could also do this:
>>
>> touch /shared/dir/[file] & chmod /shared/dir/[file] & nohup cmd1 >>
>> /shared/dir/[file] &
>>
>> K
>>
>> On Thu, Oct 23, 2008 at 08:21, Jon Taimanglo <jontaimanglo at gmail.com>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
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://calypso.tux.org/pipermail/novalug/attachments/20081023/f9a56b20/attachment.html
More information about the Novalug
mailing list