[HPADM] Re: Startup Script Question

From: Dave T. (davidlt77@hotmail.com)
Date: Wed Oct 20 2004 - 08:51:19 EDT


Thnx, Bill!

----Original Message Follows----
From: "Bill Hassell" <bill@billhassell.com>
Reply-To: bill@billhassell.com
To: "Dave T." <davidlt77@hotmail.com>
Subject: Re: [HPADM] Startup Script Question
Date: Wed, 20 Oct 2004 12:30:33 -0000

"Dave T." <davidlt77@hotmail.com> said:

> I'm writing a startup script (/sbin/init.d/sysmon) that calls
another script
> (/opt/sysadmin/bin/sysmon) to run as a daemon. Basically,
> /opt/sysadmin/bin/sysmon runs a continuous "while" loop.

Oops. Not a good design.

> In the startup
> script, I have the following line for the start option to launch
the daemon:
>
> /opt/sysadmin/bin/sysmon &

While this puts the script in the background, it cannot remain
there as the startup processing must terminate.

> When run from the command line, the startup script works
perfectly, putting
> the daemon in the background. However, when run from the rc3.d
link upon
> boot, the startup script launches the daemon, but then the
daemon
> immediately dies. What do I need to do to ensure the daemon
remains up?

Very, very different environment in a shell. The simple answer
is to shield the sysmon process from the termination steps by
the use of nohup:

nohup /opt/sysadmin/bin/sysmon &

However, I would not do this. Startup processes should run by
themselves like a daemon. So for your sysmon process, that process
should be rewritten (assuming it is an executable binary program)
to run as a true daemon. If you don't have the source code or a
way to compile it, or sysmon is itself a script, use a wrapper to
start the process in the background with a nohup. Then it will
work from a shell prompt as well as a startup script.

--
Best regards,
Bill Hassell
_________________________________________________________________
Get ready for school! Find articles, homework help and more in the Back to 
School Guide! http://special.msn.com/network/04backtoschool.armx
--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:44 EDT