On Tue, 29 May 2001, Krishna Kishore Thotakura wrote:

> Hi,
> yeah, i made a typo and
> >nohup ./startup.sh -f server_1.xml >&1 &
> did work. I am using tcsh shell. I now understand that
> >nohup ./startup.sh -f server_1.xml
> also works. But i think i should redirect stdout,stderr to some file
> coz i dont see the stdout,stderr written to nohup.out as described
> in the man pages.  i dont see the nohup.out file at all.
>
> anyway, i'll work around that. thanks for your help. u were very
> informative.

OK, here's some more information (hopefully not too much :-).

First, note that tcsh is in the csh family of shells.

In csh shells, nohup is a shell built-in command, as opposed to be a
separate executable/command, like /usr/bin/nohup.  nohup.out is
relevant to /usr/bin/nohup, but not to the csh built-in nohup.  (I'm
not sure how things are in ksh, but the ksh man page doesn't indicate
that nohup is a shell built-in command.)  That would explain why you
don't see a nohup.out file.

In csh shells, ">&1" is actually a valid redirection -- to a file
named "1"!  That is, it redirects both stdout and stderr to the file 1
in the current directory.  You might look for that file in the
directory you were in when you invoked this command.  (In csh shells,
you cannot redirect stdout and stderr separately as you can do in sh
shells.)

Recall that as I've mentioned previously, in csh shells, if you invoke
something in the background (i.e. by having a "&" at the end of the
command), you do not need to use nohup (i.e. backgrounded jobs are
automatically nohup'ed).  So, you should be able to use something like
this to do what you want:

  ./startup.sh -f server_1.xml >& /path/to/log/file

Sorry for those of you on the list that are not interested in this, I
just kept it here since it started here and in case it might be of
interest to anyone else.


> Milt Epstein wrote:
> >
> > On Mon, 28 May 2001, Krishna Kishore Thotakura wrote:
> >
> > > yeah..now, it works.
> > >
> > > >nohup ./startup.sh -f server_1.xml >&1 &
> > >
> > > could u please explain how it made a difference?
> > > What does redirection to '&1' mean? sorry, i am not a unix pro.
> >
> > Ummm, the command you show above doesn't match either of the commands
> > Jan gave.  Did you make a typo, or are you really using what you show
> > above?  And exactly which shell are you using?  (You should be able to
> > do "echo $SHELL" to find out.)
> >
> > The syntax is somewhat different for the sh et al shells and the csh
> > et al shells.  But, basically, ">" indicates "redirection".  More
> > specifically:
> >
> > In the sh et al command, "> /tmp/mytomcat.log" indicates to redirect
> > stdout to /tmp/mytomcat.log, and "2>&1" indicates to redirect stderr
> > to the same place stdout is going to (in this case, /tmp/mytomcat.log)
> > -- 2 is the file descriptor for stderr, 1 is the file descriptor for
> > stdout.
> >
> > In the csh et al command, first of all, I think Jan made a typo
> > (unless I misunderstand it, which is certainly possible :-), and left
> > out the file to redirect to.  So I think the command should be:
> >
> >   nohup ./startup.sh -f server_1.xml >& /tmp/mytomcat.log &
> >
> > But recall that csh et al shells don't need the "nohup" when a job is
> > backgrounded (done by the final "&"), so this can be simplified to:
> >
> >   ./startup.sh -f server_1.xml >& /tmp/mytomcat.log &
> >
> > ">&" means to redirect both stdout and stderr to the specified file.
> >
> > AFAIK, the "!" has to do with changing the behavior slightly when you
> > have the shell variable noclobber set.  At this point, I'd suggest
> > reading the csh man page for more specifics.
> >
> > > Jan Labanowski wrote:
> > > >
> > > > The commands can also look like:
> > > >
> > > > Under /bin/sh, /bin/ksh, /bin/bash, etc:
> > > >
> > > >   nohup ./startup.sh -f server_1.xml > /tmp/mytomcat.log 2>&1 &
> > > >
> > > > Under /bin/csh or /bin/tcsh
> > > >
> > > >   nohup ./startup.sh -f server_1.xml >&! &
> > > >
> > > > Jan
> > > > [EMAIL PROTECTED]
> > > >
> > > > On Mon, 28 May 2001, Krishna Kishore Thotakura wrote:
> > > >
> > > > > It still doesnt work. I was under the impression that tomcat
> > > > > would run in the background automatically. Also, i use the same
> > > > > command to start the tomcat process on my other port(8080), and
> > > > > it works just fine.
> > > > >
> > > > > Milt Epstein wrote:
> > > > > >
> > > > > > On Mon, 28 May 2001, Mathew Clark wrote:
> > > > > >
> > > > > > > You may need to try
> > > > > > >
> > > > > > > nohup ./startup.sh -f server_1.xml &
> > > > > > >
> >
> > Milt Epstein
> > Research Programmer
> > Software/Systems Development Group
> > Computing and Communications Services Office (CCSO)
> > University of Illinois at Urbana-Champaign (UIUC)
> > [EMAIL PROTECTED]
>
> --
> Krishna Kishore Thotakura.
> Work 256 961 7818
> Home 256 837 9927
>

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

Reply via email to