Re: Postgres FreeBSD start script fix

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bill Desjardins <bill(at)carracing(dot)com>
Cc: PostgreSQL-ports <pgsql-ports(at)postgreSQL(dot)org>
Subject: Re: Postgres FreeBSD start script fix
Date: 2001-06-21 02:11:44
Message-ID: 200106210211.f5L2Biq02160@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports


Folks, I received this change to the FreeBSD startup scripts. Seems he
changed 'su -l' to 'su'. I thought we needed the -l to simulate a full
login if they configured environment variables in the .profile script.

> Bruce,
>
> I got your name from the postgres website and figured this may be best to
> send to you as it says you apply patches and handle many things with
> postgres.
>
> this is for postgres 7.1.2 on FreeBSD 4.3 RELEASE. this was also installed
> from source and not the ports collection.
>
> The fix I am sending you is for the freebsd startup script supplied with
> postgres in:
>
> contrib/start-scripts/freebsd
>
> in its normal form, it just doesnt work :( it needed some fixing
> for the su command. it works fine now and doesnt give any errors like the
> original did.
>
> for testing, I created a completely new account with an exact stock fresh
> user and that user tried to run the original script. error was:
>
> web# ./freebsd start
> su: no directory
> postgresqlweb#
>
> the su command had incorrect quoting and command line options.
>
> the new script is as follows:
>
> -- START PATCHED SCRIPT
>
> #! /bin/sh
>
> # PostgreSQL boot time startup script for FreeBSD. Copy this file to
> # /usr/local/etc/rc.d/postgresql.
>
> # Created through merger of the Linux start script by Ryan Kirkpatrick
> # and the script in the FreeBSD ports collection.
>
> # $Header:
> /home/projects/pgsql/cvsroot/pgsql/contrib/start-scripts/freebsd,v 1.2
> 2001/04/19 19:17:44 petere Exp $
>
> ## EDIT FROM HERE
>
> # Installation prefix
> prefix=/usr/local/pgsql
>
> # Data directory
> PGDATA="/usr/local/pgsql/data"
>
> # Who to run pg_ctl as, should be "postgres".
> PGUSER=postgres
>
> # Where to keep a log file
> PGLOG="$PGDATA/serverlog"
>
> ## STOP EDITING HERE
>
> # The path that is to be used for the script
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>
> # What to use to start up the postmaster
> DAEMON="$prefix/bin/pg_ctl"
>
> test -x "$DAEMON" || exit 0
>
> case $1 in
> start)
> su $PGUSER -c "$DAEMON start -D $PGDATA -s -l $PGLOG"
> echo -n ' postgresql'
> ;;
> stop)
> su $PGUSER -c "$DAEMON stop -D $PGDATA -s -m fast"
> ;;
> restart)
> su $PGUSER -c "$DAEMON restart -D $PGDATA -s -m fast"
> ;;
> status)
> su $PGUSER -c "$DAEMON status -D $PGDATA"
> ;;
> *)
> # Print help
> echo "Usage: `basename $0` {start|stop|restart|status}" 1>&2
> exit 1
> ;;
> esac
>
> exit 0
> --END SCRIPT - CUT --
>
> a diff is:
>
> -- START DIFF --
>
> 37c37
> < su -l $PGUSER -c "$DAEMON start -D '$PGDATA' -s -l $PGLOG"
> ---
> > su $PGUSER -c "$DAEMON start -D $PGDATA -s -l $PGLOG"
> 41c41
> < su -l $PGUSER -c "$DAEMON stop -D '$PGDATA' -s -m fast"
> ---
> > su $PGUSER -c "$DAEMON stop -D $PGDATA -s -m fast"
> 44c44
> < su -l $PGUSER -c "$DAEMON restart -D '$PGDATA' -s -m fast"
> ---
> > su $PGUSER -c "$DAEMON restart -D $PGDATA -s -m fast"
> 47c47
> < su -l $PGUSER -c "$DAEMON status -D '$PGDATA'"
> ---
> > su $PGUSER -c "$DAEMON status -D $PGDATA"
>
> -- END DIFF --
>
> If you are not the right person for this, please let me know who to send
> it to and I apologize for buggin you :) if you need more information or
> would like me to test more in some way, let me know and I would be happy
> to do it.
>
> I am just moving over to postgres from mysql, and when time permits, I
> plan to follow the mailing lists, but time is short for any more email.
>
> Hope this helps out a little.
>
> Regards,
>
> Bill
>
> ---------------------------------------------------------
> Bill Desjardins - bill(at)carracing(dot)com - (USA) 305.205.8644
> http://www.CarRacing.com - Powered by FreeBSD/mod_perl
> http://www.FreeBSD.org - The Best OS money cant buy!
> http://www.EtherNeXt.com - Custom Co-Lo Solutions
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Browse pgsql-ports by date

  From Date Subject
Next Message Itzinger, Oskar 2001-06-29 07:45:35 Results of compiling PostgreSQL 7.1.2 w/IRIX 6.5.11 and MipsC 7. 3.1.2m
Previous Message Bruce Momjian 2001-06-21 00:57:18 Re: definition of PortalBuffer