The error message is
"su: /bin/bash Permission denied". The following is my startup script.
It is okay when it is run on command line.
It fails when it is called in /etc/init.d as Linux boots.
What do I need to do?
Thanks
#! /bin/sh
# PostgreSQL startup/shutdown script
#
#
case "$1" in
start)
pid=`pgrep postmaster`
if [ -n "$pid" ]
then
echo "PostgreSQL is already running\n"
else
rm -f /tmp/.s.PGSQL.* > /dev/null
echo "Starting PostgreSQL ..."
su - postgres -c '/usr/local/pgsql/bin/pg_ctl start -D
/usr/local/pgsql/data -s -l /usr/local/pgsql/data/pg.log'
sleep 1
pid=`pgrep postmaster`
if [ -n "$pid" ]
then
echo "PostgreSQL is running"
else
echo "PostgreSQL failed to start"
fi
fi
;;
stop)
echo "Stopping PostgreSQL ..."
su - postgres -c '/usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data'
sleep 2
pid=`pgrep postmaster`
if [ -n "$pid" ]
then
echo "PostgreSQL failed to stop"
else
echo "PostgreSQL is stopped"
fi
;;
status)
status postmaster
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: postgresql {start|stop|status|restart}"
exit 1
esac
exit 0