I'm trying to start/stop the postgres database manager with a SysV init
script (RH4.2).
The script (following under - line numbers not included into original)
correctly starts postgres on runlevel 3 but it won't execute in order to
stop it on runlevel 0 and/or 6. The symlinks in /etc/rc.d/rc0.d and
/etc/rc.d/rc6.d are correct but it just won't execute.
If I replace the rc0.d/rc6.d symlinks with pre-existing ones (like gpm),
well, now the gpm-symlink-to-postgres.init stops the DB manager correctly.
This gives me the ideea that those symlinks should be 'registered' to some
file/service/daemon.
But I don't know where and/or how.
Any suggestions would be greatly appreciated.
Claudiu
PS: And by the way, given the line 42
su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS} >& logger -p
${FACILITY}.notice) &" >& /dev/null&
how do I convert it from tcsh (which I know nothing about) to bash (which I
know very little about) ?
And even more
43 su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS}) &" >&
/baza/postgres.session&
44 cat /baza/postgres.start > /baza/postgres.session
45 /sbin/clock -r >> /baza/postgres.session
works but if I change the order to 44,45,43 the lines 44 and 45 would
produce no output. Why ?
------------------------------------------------
01 #!/bin/sh
02 #
03 # postgres.init Start postgres back end system.
04 #
05 # Author: Thomas Lockhart <[EMAIL PROTECTED]>
06 # modified from other startup files in the RedHat Linux distribution
07 #
08 # This version can log backend output through syslog using the local5
facility.
09 # To enable this, edit /etc/syslog.conf to include a line similar to:
10 # local5.* /var/log/postgres
11 # and then set USE_SYSLOG to "yes" below
12 #
13 #PGBIN="/opt/postgres/current/bin" # not used
14 PGACCOUNT="postgres" # the postgres account (you called it something
else?)
15 POSTMASTER="postmaster" # this probably won't change
16 USE_SYSLOG="yes" # "yes" to enable syslog, "no" to go to
/tmp/postgres.log
17 FACILITY="local5" # can assign local0-local7 as the facility for logging
18 PGLOGFILE="/tmp/postgres.log" # only used if syslog is disabled
19 #PGOPTS="-B 256"
20 PGOPTS="-i -B 256" # -i to enable TCP/IP rather than Unix socket
21 # Source function library.
22 . /etc/rc.d/init.d/functions
23 # Get config.
24 . /etc/sysconfig/network
25 # Check that networking is up.
26 # Pretty much need it for postmaster.
26 if [ ${NETWORKING} = "no" ]
27 then
28 exit 0
29 fi
30 #[ -f ${PGBIN}/${POSTMASTER} ] || exit 0
31 # See how we were called.
32 case "$1" in
33 start)
34 if [ -f ${PGLOGFILE} ]
35 then
36 mv ${PGLOGFILE} ${PGLOGFILE}.old
37 fi
38 echo -n "Starting postgres: "
39 # force full login to get path names
40 # my postgres runs tcsh so use proper syntax in redirection...
41 if [ ${USE_SYSLOG} = "yes" ]; then
42 # su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS} >& logger -p
${FACILITY}.notice) &" >& /dev/null&
43 su - ${PGACCOUNT} -c "(${POSTMASTER} ${PGOPTS}) &" >&
/baza/postgres.session&
44 cat /baza/postgres.start > /baza/postgres.session
45 /sbin/clock -r >> /baza/postgres.session
46 else
47 su - ${PGACCOUNT} -c "${POSTMASTER} ${PGOPTS} >>&! ${PGLOGFILE} &" >
/dev/null&
48 fi
49 sleep 5
50 pid=`pidof ${POSTMASTER}`
51 echo -n "${POSTMASTER} [$pid]"
52 touch /var/lock/subsys/${POSTMASTER}
53 echo
54 ;;
55 stop)
56 echo -n "Stopping postgres: "
57 pid=`pidof ${POSTMASTER}`
58 if [ "$pid" != "" ] ; then
59 echo -n "Stopping postgres: "
60 echo -n "${POSTMASTER} [$pid]"
61 kill -TERM $pid
62 sleep 1
63 cat /baza/postgres.stop >> /baza/postgres.session
64 /sbin/clock -r >> /baza/postgres.session
65 cat /baza/postgres.session >> /baza/postgres.log
66 fi
67 echo
68 ;;
69 *)
70 echo "Usage: $0 {start|stop}"
71 exit 1
72 esac
73 exit 0
----------------------------------------------
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.