Forum OpenACS Q&A: postgresql reboot script

Collapse
Posted by David Kuczek on
I put the postgresql reboot script in init.d on our remote server, but
somehow the postmaster doesn't really start on a reboot. This server
still runs on suse6.4

Is there a boot log file on linux where I can check, what problems my
server had with executing that file?

Thanks

Collapse
Posted by Jonathan Ellis on
boot log should be in /var/log/messages.

It might be more informative to stop postgres and then run your init script manually, e.g. /etc/rc.d/init.d/postgresql start

Collapse
Posted by Jonathan Ellis on
(or possibly /var/log/boot.log may have your error messages)
Collapse
Posted by David Kuczek on
Hello Jonathan,

when my server is up it is not a problem to start and stop postgres via the script. So the script works fine.

But when I reboot the server, postgres is not being started.

I checked /var/log/messages but there is nothing said about postgres:

This are the relevant lines:

Jun  6 20:25:47 arasis init: Switching to runlevel: 6

Jun  6 20:25:49 arasis su: (to postgres) root on /dev/tty1

Jun  6 20:25:49 arasis PAM-unix2[354]: session started for user postgres, service su

Jun  6 20:25:51 arasis PAM-unix2[354]: session finished for user postgres, service su

Jun  6 20:26:03 arasis sshd[200]: log: Received signal 15; terminating.

Jun  6 20:26:03 arasis kernel: nfsd: terminating on signal 9

Jun  6 20:26:03 arasis last message repeated 3 times

Jun  6 20:26:03 arasis kernel: nfsd: last server exiting

Jun  6 20:26:03 arasis kernel: nfsd_fh_shutdown : freeing 512 fhcache entries.

Jun  6 20:26:03 arasis mountd[144]: Caught signal 15, un-registering and exiting.

Jun  6 20:26:03 arasis /usr/sbin/rpc.kstatd[140]: Caught signal 15, un-registering and exiting.

Jun  6 20:26:04 arasis kernel: Kernel logging (proc) stopped.

Jun  6 20:26:04 arasis kernel: Kernel log daemon terminating.

Jun  6 20:26:05 arasis exiting on signal 15

Jun  6 21:27:17 arasis syslogd 1.3-3: restart.

Jun  6 21:27:20 arasis kernel: klogd 1.3-3, log source = /proc/kmsg started.

Jun  6 21:27:20 arasis kernel: Inspecting /boot/System.map-2.2.14

Jun  6 21:27:20 arasis kernel: Loaded 9110 symbols from /boot/System.map-2.2.14.

Jun  6 21:27:20 arasis kernel: Symbols match kernel version 2.2.14.

Jun  6 21:27:20 arasis kernel: Loaded 26 symbols from 4 modules.

Jun  6 21:27:20 arasis kernel: Serial driver version 4.27 with HUB-6 MANY_PORTS MULTIPORT SHARE_IRQ enabled

Jun  6 21:27:20 arasis kernel: ttyS00 at 0x03f8 (irq = 4) is a 16550A

Jun  6 21:27:20 arasis kernel: ttyS01 at 0x02f8 (irq = 3) is a 16550A

Jun  6 21:27:20 arasis kernel: 3c59x.c:v0.99L 5/28/99 Donald Becker http://cesdis.gsfc.nasa.gov/linux/drivers/vortex.html

Jun  6 21:27:20 arasis kernel: eth0: 3Com 3c900 Cyclone 10Mbps Combo at 0xa800,  00:10:4b:dc:bf:ad, IRQ 5

Jun  6 21:27:20 arasis kernel:  8K byte-wide RAM 5:3 Rx:Tx split, autoselect/Autonegotiate interface.

Jun  6 21:27:20 arasis kernel:  MII transceiver found at address 24, status 182d.

Jun  6 21:27:20 arasis kernel:  Enabling bus-master transmits and whole-frame receives.

Jun  6 21:27:20 arasis kernel: Installing knfsd (copyright (C) 1996 mailto:okir@monad.swb.de)

Jun  6 21:27:20 arasis kernel: nfsd_fh_init : initialized fhcache, entries=512

Jun  6 21:27:21 arasis sshd[200]: log: Server listening on port 22.

Jun  6 21:27:21 arasis sshd[200]: log: Generating 768 bit RSA key.

Jun  6 21:27:22 arasis sshd[200]: log: RSA key generation complete.

Jun  6 20:27:22 arasis ntpdate[202]: step time server 194.95.250.35 offset -3599.949600 sec

Jun  6 20:27:22 arasis xntpd[205]: ntpd 4.0.99f Sat Mar 11 10:19:28 GMT 2000 (1)

Jun  6 20:27:22 arasis xntpd[205]: signal_no_reset: signal 13 had flags 4000000

Jun  6 20:27:22 arasis xntpd[205]: precision = 24 usec

Jun  6 20:27:22 arasis xntpd[205]: kern_enable is 1

Jun  6 20:27:22 arasis xntpd[205]: using kernel phase-lock loop 0040

Jun  6 20:27:22 arasis xntpd[205]: frequency initialized 0.000 from /etc/ntp.drift

Jun  6 20:27:22 arasis xntpd[205]: using kernel phase-lock loop 0041

Jun  6 20:27:22 arasis /usr/sbin/cron[209]: (CRON) STARTUP (fork ok)

Jun  6 20:27:22 arasis in.identd[213]: started

Jun  6 20:27:25 arasis kernel: tcpdump uses obsolete (PF_INET,SOCK_PACKET)

Jun  6 20:27:25 arasis kernel: eth0: Setting promiscuous mode.

Jun  6 20:27:25 arasis kernel: device eth0 entered promiscuous mode

Jun  6 20:28:01 arasis sshd[273]: connect from mailto:root@217.80.57.162

Jun  6 20:28:01 arasis sshd[273]: log: Connection from 217.80.57.162 port 1819

Jun  6 20:28:02 arasis sshd[273]: log: RhostsRsa authentication not available for connections from unprivileged port.

Jun  6 20:28:05 arasis sshd[273]: log: Password authentication for root accepted.

Jun  6 20:28:05 arasis sshd[273]: log: ROOT LOGIN as 'root' from pd95039a2.dip.t-dialin.net

Collapse
Posted by Jonathan Ellis on
Besides moving it to init.d, did you link to it from the various runlevel directories?  Redhat has a tool called chkconfig to make this easier; I don't know about suze.
Collapse
Posted by David Kuczek on
I did all the linking form rc0.d - rc5.d as said in the postgresql-file. I don't think that suse6.4 has chkconfig as far as I know.

How do you call chkconfig on rh?

Collapse
Posted by Jonathan Ellis on
[root@albatros root]# which chkconfig
/sbin/chkconfig

One thing you could try is find rc.local and make a call to the postgres start script there.  See if that works.  The other thing I'd try is use telinit to switch runlevels without rebooting.

Collapse
Posted by David Kuczek on
Hello Jonathan,

I put "/etc/rc.d/init.d/postgresql start" into /etc/rc.d/boot.local which is the suse equivalent for rc.local and then tried a telinit 6. The script was executed this time!!! Thanks

I know that you are laughin now, but telinit 6 rebooted the system as if I did it with init 6. What did you exactly mean with "trying telinit"?

In which order are scripts executed?

Does the system try to execute the script that is located in init.d first and then checks whatever is located in rc.local??

Will the inittab be activated after all the scripts in init.d are executed?

Thanks
Collapse
Posted by Jonathan Ellis on
By "trying telinit" I meant, change to the different runlevels and see if the postgres start script gets executed.  Telinit will call the S scripts in the rcX.d level you are entering, and the K scripts in the level you are leaving.  By convention the most common runlevels are runlevel 1 = single user mode, 3 = networked mode, 5 = networked with X, 0 = halt, 6 = reboot.  Man telinit for details.

/etc/inittab controls what gets executed; on redhat this calls /etc/rc.d/rc with the runlevel number, which handles going through the rcX.d directory and calling the scripts.  Lower numbers get called first.

init.d is totally ignored by this.  As a convention, people put the "real" script in init.d and symlinks to it in the rcX.d directories corresponding to the runlevels they want it in.  E.g. you may not want to bother starting postgres when you are in runlevel 1.