Skip to main content

Thread: PostgreSQL init.d script not working


hi,

have installed postgresql source (as need 9.0) in ununtu 10.04 (with no gui). installed to:

opt/postgresql

setup database cluster opt/postgresql/data - worked ok, , user 'postgres'.

init.d script supplied called linux , did normal stuff, script won't work. gives error:

"-bash: /etc/init.d/postgresql: /bin/sh^m: bad interpreter: no such file or directory"

altered init.d script follows:

code:
 #! /bin/sh  # chkconfig: 2345 98 02 # description: postgresql rdbms  # example of start/stop script sysv-style init, such # used on linux systems.  should edit of variables # , maybe 'echo' commands. # # place file @ /etc/init.d/postgresql (or # /etc/rc.d/init.d/postgresql) , make symlinks #   /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 have chkconfig, simply: # chkconfig --add postgresql # # proper init scripts on linux systems require setting lock # , pid files under /var/run reacting network # settings, should treat care.  # original author:  ryan kirkpatrick <pgsql@rkirkpat.net>  # contrib/start-scripts/linux  ## edit here  # installation prefix prefix=/opt/postgresql  # data directory pgdata="/opt/postgresql/data"  # run postmaster as, "postgres".  (not "root") pguser=postgres  # keep log file pglog="$pgdata/serverlog"  # it's idea protect postmaster being killed # oom killer (which tend preferentially kill postmaster because # of way accounts shared memory).  setting oom_adj value # -17 disable oom kill altogether.  if enable this, want # compile postgresql "-dlinux_oom_adj=0", individual backends # can still killed oom killer. #oom_adj=-17  ## stop editing here  # path used script path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin  # use start postmaster.  (if want script wait # until server has started, use "pg_ctl start -w" here. # without -w, pg_ctl adds no value.) daemon="$prefix/bin/postmaster"  # use shut down postmaster pgctl="$prefix/bin/pg_ctl"  set -e  # start if can find postmaster. test -x $daemon || { 	echo "$daemon not found" 	if [ "$1" = "stop" ] 	then exit 0 	else exit 5 	fi }   # parse command line parameters. case $1 in   start) 	echo -n "starting postgresql: " 	test x"$oom_adj" != x && echo "$oom_adj" > /proc/self/oom_adj 	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" 	test x"$oom_adj" != x && echo "$oom_adj" > /proc/self/oom_adj 	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 	echo "usage: $0 {start|stop|restart|reload|status}" 1>&2 	exit 1 	;; esac  exit 0
could me please? totally stumped , have been googleing , reading hours now. seems default linux script supplied not work ubuntu 10.04.

nb: *need* 9.0 hence installing source.

appreciate can give.

thanks,

tt

i checked file permissions way - 755, should execute.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [SOLVED] PostgreSQL init.d script not working


Ubuntu

Comments