larry a price wrote:

> I have a program (postgres) that I want to start in the background
> whenever the box goes to a runlevel 2 or higher
> what I want to know is if I put the following in /etc/init.d:
> 
>       su postgres
>       nohup postmaster -i >pglog 2>&1 &
>       exit
> 
> will that create a huge gaping security hole that i'm not aware of ,
> and if so what don't i know and where would i look to find out?

Here (as an attachment) is the script from Mandrake's postgreSQL RPM.
You can probably use it, with maybe minor editing for paths.

I'd like to start playing with postgreSQL too.  MySQL just doesn't
cut it.

-- 
                                        K<bob>
[EMAIL PROTECTED], http://www.jogger-egg.com/
#! /bin/sh
# postgresql    This is the init script for starting up the PostgreSQL
#               server
#
# chkconfig: 345 85 15
# description: Starts and stops the PostgreSQL backend daemon that handles \
#              all database requests.
# processname: postmaster
# pidfile: /var/run/postmaster.pid
# 

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
# Pretty much need it for postmaster.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/bin/postmaster ] || exit 0

# This script is slightly unusual in that the name of the daemon (postmaster)
# is not the same as the name of the subsystem (postgresql)

# See how we were called.
case "$1" in
  start)
        echo -n "Starting postgresql service: "
        su -l postgres -c '/usr/bin/postmaster -S -D/var/lib/pgsql'
        sleep 1
        pid=`pidof postmaster`
        echo -n "postmaster [$pid]"
        touch /var/lock/subsys/postgresql
        echo $pid > /var/run/postmaster.pid
        echo
        ;;
  stop)
        echo -n "Stopping postgresql service: "
        killproc postmaster
        sleep 2
        rm -f /var/run/postmaster.pid
        rm -f /var/lock/subsys/postgresql
        echo
        ;;
  status)
        status postmaster
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: postgresql {start|stop|status|restart}"
        exit 1
esac

exit 0

Reply via email to