I know it is stupid but how to use gdb to get backtrace? I type "bt" before the process dead, it show me this:
(gdb) bt
#0 0x003e67a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x0065451e in do_sigwait () from /lib/tls/libpthread.so.0
#2 0x006545bf in sigwait () from /lib/tls/libpthread.so.0
#3 0x00b26056 in ns_sigwait ()
from /usr/local/AOLserver4.0.9/lib/libnsthread.so
#4 0x00dff7f6 in NsHandleSignals ()
from /usr/local/AOLserver4.0.9/lib/libnsd.so
#5 0x00de67a9 in Ns_Main () from /usr/local/AOLserver4.0.9/lib/libnsd.so
#6 0x0804861d in main ()
After the process dead, it give me this:
(gdb) bt
#0 0x003e67a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
Error accessing memory address 0xbff687b4: No such process.
Is that enough? What did I miss? How to obtain what I lost?
Also, I see no reason why you needed to write any bash script to, "monitor the service and restart it everytime it dies". Why did you do this? Getting AOLserver to restart anytime it is killed is easy, just use /etc/inittab or Daemontools, as is described in the OpenACS docs.
First reason is I tried the Inittab method but it gets my machine down. Second, I know bash better than Daemontools. Third thing is I need to monitor the service status on web interface with wget.
Anyway, my bash is working so fine and I have all that I need.