Hi Ted:

I just went through some of this and there are a couple of things
to watch out for. See the "init/rc scripts" thread in the maillist
archives for details:

https://listman.redhat.com/mailman/private/redhat-list/2002-April/137519.htm
l

Basically you will need to:

1. Write a script to start/stop your process. This script will
   need a minimum of two comment lines ("chkconfig:" and
   "description:") to supply info to chkconfig. It will need
   to handle a parameter with a minimum of 2 values (start and
   stop). It will also need to create/delete a marker file in
   /var/lock/subsys/.

2. Copy the script to /etc/init.d/.

3. Use the "chkconfig --add name" command to populate the
   /etc/rc*.d/ directories.

For example, say we have a script (xxxsrv) that contains:

  :
  # chkconfig:  235 99 01
  # description:        Sample XXX server
  #
  CMD=`basename $0`
  PRG=`echo "${CMD}" | sed -e 's/[KS][0-9][0-9]//'`

  case $1 in
      start)
          /usr/bin/XXXstart
          touch /var/lock/subsys/${PRG}
          ;;
      stop)
          /usr/bin/XXXstop
          rm /var/lock/subsys/${PRG}          ;;
      *)
          echo "Usage: ${PRG} {start|stop}"
          ;;
  esac

The "235" in the "chkconfig:" comment will tell chkconfig to
install the script into rc2.d, rc3.d and rc5.d. The "99" and
"01" will tell chkconfig the "level number" to use in the S
and K filenames. So after coping our xxxsrv script to
/etc/init.d and then running "chkconfig --add xxxsrv" we will
have the the following links to the /etc/init.d/xxxsrv script:

/etc/rc0.d/K01xxxsrv
/etc/rc1.d/K01xxxsrv
/etc/rc2.d/S99xxxsrv
/etc/rc3.d/S99xxxsrv
/etc/rc4.d/K01xxxsrv
/etc/rc5.d/S99xxxsrv
/etc/rc6.d/K01xxxsrv

Not that I have not tested the script above but it is a hack
of my working script so I would not anticipate a problem with
it.

That should get you started but check out the references that I
was given in the archived messages for more info.

HTH

Regards, Hugh

--
Hugh E Cruickshank, Forward Software, www.forward-software.com

> -----Original Message-----
> From: Ted Gervais
> Sent: Saturday, May 18, 2002 9:50 AM
>
> I have an application I want to run in my RedHat 7.3 system and
> its called
> from /usr/sbin directory.  To get it to run at boottime, I stuck
> a link to
> it from /etc/rc.d/rc3.d.   It works but I know this is not the
> right way to
> do things.  It seems to me that I should be writing a script to
> bring that
> application up, rather than just calling it from where it sleeps.  Of
> course I sometimes also call some of these applications from the
> /etc/rc.d/rc.local.  Rather than through proper scripts etc..
>
> I want to do it the right way, at least for once.  Is there a
> step by step
> process I can follow to get at least one of these applications
> starting up
> right and closing down properly?  I don't want to learn the process *
> indepth *, but enough to get ONE working and even if it was down
> for me, it
> would be a great example to follow for  the future.
>
> Any thoughts guys?
>
> ---
> Ted Gervais,
> Coldbrook, Nova Scotia, Canada



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to