Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Shell script to start PostgreSQL

  • 09-01-2002 06:24PM
    #1
    Registered Users, Registered Users 2 Posts: 2,518 ✭✭✭


    I installed the FreeBSD port of PostgreSQL onto my system (4.5-PRELEASE) here, while it starts fine with the postmaster or pg_ctl commands, it simply refuses to start at boot, even with the shell script that was supplied with the port.

    Seems to be in the right place (/usr/local/etc/rc.d/), it's executable and readable. I decided to run the script itself to see what the output is, this is what it returned: "su: no directory".

    heres the script itself:

    #!/bin/sh

    # $FreeBSD: ports/databases/postgresql7/files/pgsql.sh.tmpl,v 1.12 2001/05/02 11:44:38 olgeni Exp $
    #
    # For postmaster startup options, edit $PGDATA/postgresql.conf

    PGBIN=/usr/local/bin

    case $1 in
    start)
    [ -d /usr/local/lib ] && /sbin/ldconfig -m /usr/local/lib
    [ -x ${PGBIN}/pg_ctl ] && {
    su -l pgsql -c \
    '[ -d ${PGDATA} ] && exec /usr/local/bin/pg_ctl start -s -w -l ~pgsql/errlog'
    echo -n ' pgsql'
    }
    ;;

    stop)
    [ -x ${PGBIN}/pg_ctl ] && {
    su -l pgsql -c 'exec /usr/local/bin/pg_ctl stop -s -m fast'
    echo -n ' pgsql'
    }
    ;;

    status)
    [ -x ${PGBIN}/pg_ctl ] && {
    exec su -l pgsql -c 'exec /usr/local/bin/pg_ctl status'
    }
    ;;

    *)
    echo "usage: `basename $0` {start|stop|status}" >&2
    exit 64
    ;;
    esac

    Could it be somthing to do with Postgres' requirement that the dbms be started by an unpriveleged user ?


Advertisement