Re: Creating Log file - run in background. - Mailing list pgsql-novice

From Sterling
Subject Re: Creating Log file - run in background.
Date
Msg-id 3A394D2A.B3CE73A5@omeninc.com
Whole thread Raw
In response to Re: Creating Log file - run in background.  (Chris <csmith@squiz.net>)
List pgsql-novice
H-

Thanks for the detailed information. Explainations are always welcome. I understand a
lot more about what it's trying to do now that I know what it's suppose to do. 8^)

Well based on all the input I've gotten I did some things.

Here is the command that I came up with to run:
nohup /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data <
/dev/null>>/usr/local/pgsql/data/server.log 2>> 1&

I'm running this command as postgres user. I'm still getting this error message when
attempting to run the command.
[postgres@XXXX local]$ nohup /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data <
/dev/null>>/usr/local/pgsql/data/server.log 2>> 1&
[1] 14869
[postgres@XXXX local]$ bash: 1: Permission denied
[1]+  Exit 1                  nohup /usr/local/pgsql/bin/postmaster -D
/usr/local/pgsql/data </dev/null >>/usr/local/pgsql/data/server.log 2>>1

Thinking that it might be a permission issue I did:

chown -R postgres.postgres /usr/local/pgsql

that directory and removed the server.log file I touched before.
On a good note it's creating that file. Here's what it said.
less server.log
/bin/bash: /home/XXXX/.bashrc: Permission denied

This makes me think it might be some things that are set up in my bashrc. But what could
that be? I installed and compiled the code without problems. Of course I did it as root.

Perhaps I'm going about this the wrong way. Is there some other command I can use to get
this process working?

Not even the basic command will start postgres now.
[postgres@XXXX data]$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
DEBUG:  Data Base System is starting up at Thu Dec 14 16:34:10 2000
DEBUG:  Data Base System was shut down at Thu Dec 14 16:33:21 2000
DEBUG:  Data Base System is in production state at Thu Dec 14 16:34:10 2000
Fast Shutdown request at Thu Dec 14 16:34:18 2000
DEBUG:  Data Base System shutting down at Thu Dec 14 16:34:18 2000
DEBUG:  Data Base System shut down at Thu Dec 14 16:34:18 2000

What's this?

Sorry for extended delay in replying but I had to re-subscribe to the list. For some
reason it dropped me. Maybe I sent too many emails. 8^)

Well thanks for any info you might have. The learning continues.
-Sterling



John Burski wrote:

> It looks like the "> >" between the "-D" (postmaster command line option) and the
> "/usr/local/pgsql/data" filename are continuations in your e-mail window.
>
> The ">>" between the "/dev/null" filename and the "/user/local/.../server.log"
> filename are meant to redirect the output to stdout (standard output, usually the
> screen) and append it the file name that follows, in this case
> "/usr/local/.../server.log".
>
> Here's what the command is supposed to do:
>
>      nohup - Execute the following command, making it immune to "hangups" and
>      with output to a non-tty device.
>
>      /usr/local/.../postmaster -D /usr/local/pgsql/data - Execute the postmaster
>      program, using /usr/local/pgsql/data directory as the root of the tree of
>      database directories.
>
>      < /dev/null - Input is redirected from the bit-bucket.  (Don't ask me why -
>      I've not looked closely enough at the nitty-gritty to understand that yet).
>
>      >> /usr/local/pgsql/data/server.log - Redirect anything output to stdout to
>      this file.
>
>      2>>1 - Redirect and append anything output to stderr to stdout.  This
>      causes both stdout and stderr to be logged in the same file
>
>      & - Run in the background.
>
> Hope that helps.
>
> Regards.
>
> Sterling wrote:
>
> > H-
> >
> > Ok. So the new command should look like this.
> >
> > nohup /usr/local/pgsql/bin/postmaster -D  > >/usr/local/pgsql/data </dev/null
> > >>/usr/local/pgsql/data/server.log 2>>1 &
> >
> > What are the > > 's for? Are they acting as ( ) 's like in perl or some other
> > language?
> >
> > If so should they match? I'm getting lost in the > > and can't figure out if the >
> > > is actually in the command or part of the wrapping for my window terminal (it
> > stays when I resize the window so...)  or from my email client when it copies the
> > original post.
> >
> > Thanks for all your help and replies. I just need to get up to speed on what
> > you're telling me. 8^)
> > -Sterling
> >
> > Tom Lane wrote:
> >
> > > >> Should the command look like this than:
> > > >> nohup /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data/server.log &
> > >
> > > > That should work, yep.
> > >
> > > Uh, nope.
> > >
> > > That will try to use /usr/local/pgsql/data/server.log as a directory.
> > >
> > > Your original advice was better.
> > >
> > >                         regards, tom lane
>
> --
> John Burski
> Chief IT Cook and Bottlewasher
> 911 Emergency Products, St. Cloud, MN
> (320) 656 0076


pgsql-novice by date:

Previous
From: Sandeep Joshi
Date:
Subject: what is wrong?
Next
From: Sterling
Date:
Subject: Re: Creating Log file - run in background.