Need help running a script at boot...

From: Edward C. Bailey <ed_at_pigdog.niehs.nih.gov>
Date: Thu, 16 Nov 1995 14:08:17 -0500

Hello,

    I have a problem. We have a 2100 running OSF/1 3.0, and are trying to
start mSQL, which is a public-domain SQL implementation, at boot time.
Here's what we have:

In /sbin/rc3.d/S99msqld:

#!/bin/sh
echo "Starting msqld..."
/usr/local/Minerva/run_daemon msqld

As you can see, there's not much there. As you'll be able to see from
run_daemon below, this script will never return, and would therefore hang
the boot process. This is where I came in (I've inherited this problem as
the original perpetrator has since gone on to greener pastures). My first
attempt was to simply put a "&" at the end of the invocation of
run_daemon. This permitted the boot to complete normally, but the job
running run_daemon was gone - it should have hung around, re-running msqld
as necessary.

    I've tried just about everything I can think of to get this to work,
and have come up dry. I figure it's either something so stupid I'll be
banging my head on the desk, so I thought who better to be humiliated by
than this list! :-)

    In any case, any insights would be greatly appreciated...

                                Ed

P.S. the script run_daemon referenced above follows...

P.P.S. I get an empty "output" file from the line that runs the daemon.
I've added echos into a trace file, and find that run_daemon does execute,
right up to the line that runs the daemon. By the time I log in, there is
no daemon, and no run_daemon job...

In /usr/local/Minerva/run_daemon:

#!/bin/sh
#
# Because this stuff is still pretty young, you may wish to run the
# server using this script. It'll notify if the server crashes and
# restart it after a couple of minutes. It also puts the core in a known
# place and mails you any output generated by the terminal process.
#
# run it as 'run_daemon msqld' to run the mSQL engine.
#
# bambi_at_Bond.edu.au

INST_DIR=/usr/local/Minerva
ADMIN="root"
PROG=$1

if test ! -d "${INST_DIR}/debug"
then
        mkdir ${INST_DIR}/debug
fi

if test ! -d "${INST_DIR}/debug/${PROG}"
then
        mkdir ${INST_DIR}/debug/${PROG}
fi

while :
do
        cd ${INST_DIR}/debug/${PROG}
        ${INST_DIR}/bin/${PROG} > output 2>&1
        echo "Program : ${PROG}
Time : `date`
Program Output
--------------

" > mail.tmp
        cat output >> mail.tmp
        Mail -s "Minerva Daemon Crash Report" ${ADMIN} < mail.tmp
        sleep 15
done
-- 
Ed Bailey, Information Systems and Networks
(contracted to: National Institute of Environmental Health Sciences)
2327 Englert Drive.
Suite 200
Durham, NC 27713
                              
 Internet: bailey_at_niehs.nih.gov
   BITnet: BAILEY_at_NIEHS.BITNET 
    Voice: (919)361-9422, extension 239
      FAX: (919)544-6642
Received on Thu Nov 16 1995 - 20:47:38 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT