Re: Auto Starting +/or Shutdown on OS X

Поиск
Список
Период
Сортировка
От Ralph Smith
Тема Re: Auto Starting +/or Shutdown on OS X
Дата
Msg-id 46AF8D2B.7010706@u.washington.edu
обсуждение исходный текст
Ответ на Re: Auto Starting +/or Shutdown on OS X  (Michael Glaesemann <grzm@seespotcode.net>)
Ответы Re: Auto Starting +/or Shutdown on OS X  (Michael Glaesemann <grzm@seespotcode.net>)
Re: Auto Starting +/or Shutdown on OS X  (John DeSoi <desoi@pgedit.com>)
Список pgsql-general
=== INITIAL POST ====================
I'm using scripts in /Library/StartupItems/PostgreSQL

PostgreSQL starts manually just fine via
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l
/usr/local/pgsql/logfile start

PostgreSQL will not start on System restart using files in
/Library/StartupItems/PostgreSQL (no longer below).

If I execute the start command above just after a System start I get
   pg_ctl: another server may be running; trying to start server anyway
   server starting
and then it starts and runs fine.

If I shut down PG using
  pg_ctl stop (no users connected)
it stops and subsequently starts using code above just fine, w/o the
warning.

---
I added the command:
  date > /Users/showmefile
to appropriate portions of /Library/StartupItems/PostgreSQL/PostgreSQL
as seen below, and the script portions ARE appropriately being executed.

How come shutdown isn't clearing things up?
Or is the problem in the startup?

Thanks!

=== FIRST REPLY ===========================

Michael G  wrote:
On Jul 30, 2007, at 16:14 , Ralph Smith wrote:

I'm using scripts in /Library/StartupItems/PostgreSQL

I haven't used a StartupItem for PostgreSQL since launchd was released.
I haven't looked too closely at your configuration, but you might
consider using a launchd plist instead. Here's one of mine (from
/Library/LaunchDaemons/org.postgresql.postgres.v824.plist). Note that if
you use one of the plist launchd configuration editors out there you'll
probably lose the comments when you save.

Hope this helps.

Michael Glaesemann
grzm seespotcode net

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
This launchd.plist file is used by the launchd process (availabie on
Mac OS X 10.4 and later) to launch and shutdown a PostgreSQL server.
The launchd.plist is used instead of a StartupItem. For detailed
descriptions
of launchd parameters and launchd, refer to to the launchd.plist,
launchd, and
launchctl manpages.

launchd.plists are commonly named in a manner similar to preference
plist files,
so for consistency (and easy identification) launchd.plists for PostgreSQL
server instances should begin with org.postgresql.postgres. When running
multiple server instances on one machine, you may wish to distinguish
them. For
example, if one of your PostgreSQL servers is 8.0 and another 8.1, you
might
name the two launchd.plist files

org.postgresql.postgres.v80.plist
org.postgresql.postgres.v81.plist

Another alternative is to identify them by use. For example, when
running one
development server instance and a production server instance on the same
machine, you might name the two launchd.plist files

org.postgresql.postgres.dev.plist
org.postgresql.postgres.prod.plist

Note: While commments in launchd.plist files do not appear to interfere
with
launchd operation, editing and saving this file using Property List Manager
will *not* preserve comments (including these)!

-->
<dict>
        <key>Label</key>
        <!-- Set the Label parameter to a unique string identifying the
job to
             launchd. This is commonly set to the naem of the
launchd.plist file
             without the .plist extension.
          -->
        <string>org.postgresql.postgres.v824</string>
        <key>OnDemand</key>
        <false/>
        <key>Disabled</key>
    <!-- Set the OnDemand parameter to <true/> to prevent the server from
         starting automatically on system start or when launched by
launchctl.
      -->
        <false/>
        <key>ProgramArguments</key>
    <!-- The elements of the ProgramArguments parameter array are the
command
         line string used to start the server, exploded on white space. No
         string should contain spaces.

         The first element is the absolute path to the postmaster server
         application binary, followed by the argments to be passed to the
         postmaster server application. Add, delete, and update these
         parameter strings as needed for your requirements. The example
includes
         setting the database data directory (PGDATA) and sets the
         redirect_stderr runtime parameter.
      -->
        <array>

<string>/usr/local/pgsql/pgsql-8.2.4/bin/postmaster</string>
                <string>-D</string>
                <string>/usr/local/pgsql/pgsql-8.2.4/data</string>
                <string>-c</string>
                <string>redirect_stderr=YES</string>
        </array>
        <key>ServiceDescription</key>
        <!-- The ServiceDescription parameter is a human-readable string
to describe
             the purpose of the service provided, in this case the
PostgreSQL dbms
             server.
      -->
        <string>PostgreSQL Server v8.2.4</string>
        <key>UserName</key>
        <!-- Set the Username parameter string to the user who is to
owns the PostgreSQL
             server process, typically "postgres".
      -->
        <string>postgres</string>
        <key>GroupName</key>
        <!-- Set the GroupName parameter to group of the user who is to
own the
             PostgreSQL process, typically "postgres".
          -->
        <string>postgres</string>
</dict>
</plist>

=== COUNTER REPLY ===============================

Ralph Replies:
Thanks Michael.

But alas, auto-starting still doesn't work!

I renamed the file in the FORMERLY like-named DIR in
/Library/StartupItems/PostgreSQL to inactivate it.
Then I inserted your .plist text below into /Library/LaunchDaemons as
org.postgresql.postgres.v824.plist
Owner/Group root/wheel, 644 perms.

However... PostgreSQL still won't start at boot up!
In the system.log I get the errors you can see below.
Also there are my modifications to the .plist file -- to match my
install, and some debugging I added.

I'm looking at getting that debugging to log where I can find it.
Can someone help me config extended logging?
log_destination, log_directory, log_filename
Or is startup too soon for these to help me here?

Thanks,
Ralph
---------------------------------------

Jul 30 17:11:40 swampmac lookupd[90]: lookupd (version 369.5) starting -
Mon Jul 30 17:11:40 2007
Jul 30 17:11:40 swampmac configd[52]: posting notification
com.apple.system.config.network_change
Jul 30 17:11:40 swampmac lookupd[91]: lookupd (version 369.5) starting -
Mon Jul 30 17:11:40 2007
Jul 30 17:11:40 swampmac configd[52]: setting hostname to
"swampmac.eplt.washington.edu"
Jul 30 17:11:40 swampmac loginwindow[83]: Login Window Started Security
Agent
Jul 30 17:11:42 swampmac
/System/Library/CoreServices/mcxd.app/Contents/MacOS/mcxd: DSOpenNode():
dsOpenDirNode("/Active Directory/All Domains") == -14002
Jul 30 17:11:43 swampmac configd[52]:   target=enable-network: disabled
Jul 30 17:11:43 swampmac launchd: org.postgresql.postgres.v824: exited
with exit code: 1
Jul 30 17:11:43 swampmac launchd: org.postgresql.postgres.v824:
respawning too quickly! throttling
Jul 30 17:11:43 swampmac launchd: org.postgresql.postgres.v824: 8 more
failures without living at least 60 seconds will cause job removal
Jul 30 17:11:43 swampmac launchd: org.postgresql.postgres.v824: will
restart in 10 seconds
Jul 30 17:11:44 swampmac VersionCueCS2Daemon[198]: warning:
VersionCueCS2Daemon not started by mach_init process (parent pid: 1)
Jul 30 17:11:45 swampmac configd[52]: AppleTalk startup complete
Jul 30 17:11:53 swampmac launchd: org.postgresql.postgres.v824: exited
with exit code: 1
Jul 30 17:11:53 swampmac launchd: org.postgresql.postgres.v824:
respawning too quickly! throttling
Jul 30 17:11:53 swampmac launchd: org.postgresql.postgres.v824: 7 more
failures without living at least 60 seconds will cause job removal
Jul 30 17:11:53 swampmac launchd: org.postgresql.postgres.v824: will
restart in 10 seconds



Modifications to the .plist file:

                <string>/usr/local/pgsql/bin/postmaster</string>
                <string>-D</string>
                <string>/usr/local/pgsql/data</string>
                <string>-l</string>
                <string>/usr/local/pgsql/logfile</string>
                <string>-c</string>
                <string>redirect_stderr=YES</string>
                <string>-c</string>
                <string>log_min_message=DEBUG5</string>
                <string>-c</string>
                <string>log_error_verbosity=VERBOSE</string>


===============================================

В списке pgsql-general по дате отправления:

Предыдущее
От: Mike Haberman
Дата:
Сообщение: Re: FOREIGN KEY migration of syntax, help needed
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: plperl syntax highlighting for vi