Skip site navigation (1) Skip section navigation (2)

boot on Debian with /etc/init.d/rc ...

From: Raimon Fernandez <coder(at)montx(dot)com>
To: PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org>
Subject: boot on Debian with /etc/init.d/rc ...
Date: 2009-01-30 16:38:47
Message-ID: 628C7596-88D0-47BB-BFEF-F713F8BD2314@montx.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,

After some months of Postgre on OS X, amb trying to install a complete  
package of Ruby On Rails with PostgreSQL, Capistrano, git, etc. etc.  
on a Debian linux.

I've installed PostgreSQL from source, and executed the commands to  
install the start-up script:

$ cp contrib/start-scripts/linux /etc/init.d/postgresql
$ update-rc.d postgresql defaults

on boot time, I'm getting a Permission denied:

/etc/init.d/rc: line 78: /etc/rc2.d/S20postgresql : Permission denied


even If I execute this line as a root I'm getting the permission denied:

/etc/init.d/postgresql start


I can start the database logged as the postgre user and executing:

/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data

my postgres user is postgres user, all with the default values.

here is the file, in case someone can view any error ...

thanks in advance,

r.



#! /bin/sh

# chkconfig: 2345 98 02
# description: PostgreSQL RDBMS

# This is an example of a start/stop script for SysV-style init, such
# as is used on Linux systems.  You should edit some of the variables
# and maybe the 'echo' commands.
#
# Place this file at /etc/init.d/postgresql (or
# /etc/rc.d/init.d/postgresql) and make symlinks to
#   /etc/rc.d/rc0.d/K02postgresql
#   /etc/rc.d/rc1.d/K02postgresql
#   /etc/rc.d/rc2.d/K02postgresql
#   /etc/rc.d/rc3.d/S98postgresql
#   /etc/rc.d/rc4.d/S98postgresql
#   /etc/rc.d/rc5.d/S98postgresql
# Or, if you have chkconfig, simply:
# chkconfig --add postgresql
#
# Proper init scripts on Linux systems normally require setting lock
# and pid files under /var/run as well as reacting to network
# settings, so you should treat this with care.

# Original author:  Ryan Kirkpatrick <pgsql(at)rkirkpat(dot)net>

# $PostgreSQL: pgsql/contrib/start-scripts/linux,v 1.8 2006/07/13  
14:44:33 petere Exp $

## EDIT FROM HERE

# Installation prefix
prefix=/usr/local/pgsql

# Data directory
PGDATA="/usr/local/pgsql/data"

# Who to run the postmaster as, usually "postgres".  (NOT "root")
# 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 (we do NOT use pg_ctl for this,
# as it adds no value and can cause the postmaster to misrecognize a  
stale
# lock file)
DAEMON="$prefix/bin/postmaster"

# What to use to shut down the postmaster
PGCTL="$prefix/bin/pg_ctl"

set -e

# Only start if we can find the postmaster.
test -x $DAEMON || exit 0

# Parse command line parameters.
case $1 in
   start)
         echo -n "Starting PostgreSQL: "
         su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
         echo "ok"
         ;;
   stop)
         echo -n "Stopping PostgreSQL: "
         su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
         echo "ok"
         ;;
   restart)

        echo -n "Restarting PostgreSQL: "
         su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
         su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
         echo "ok"
         ;;
   reload)
         echo -n "Reload PostgreSQL: "
         su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"
         echo "ok"
         ;;
   status)
         su - $PGUSER -c "$PGCTL status -D '$PGDATA'"
         ;;
   *)
         # Print help
         echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2
         exit 1
         ;;
esac

exit 0





In response to

Responses

pgsql-novice by date

Next:From: salmanDate: 2009-01-30 16:52:58
Subject: Re: boot on Debian with /etc/init.d/rc ...
Previous:From: Keith TurnerDate: 2009-01-30 16:35:06
Subject: Re: REALLY stupid question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group