RE: RedHat Scripts

2002-05-19 Thread Ted Gervais


Hello Hugh and others on the list.

Well I tried the script and it DOES work.  At least the application is 
brought up just fine and there are no errors that I can see.
Same things when things are shutting down. There are no errors.

I may be premature in saying I see success here, but at least for the 
moment I do.  I will have to try a few more of my applications yet and than 
I will really know.

Also Hugh, I tried to write you privately yesterday and your email address 
failed. Maybe I don't have it correctly..  I wanted you to have a quick 
look at a script I have here that no longer seems to work.  I am guessing 
that maybe the change to newer versions of RedHat may be the problem?? I 
wonder eh?

Anyways - thanks very much for your input. I also read the backgroup you 
spoke of which basically was supporting what you were doing or were after.
All this has been very informative and will no doubt help me continue on to 
extensions of  these scripts.

I wish there was a more automatic way to do these scripts, but I guess not. 
Or at least not at this moment.  A simple 'fill-in-the-blanks' 
process.  Something where you would enter (on a form) what the name of the 
application is. Where it was located. And what is the purpose of this 
application (description).  And than maybe something like the various 
levels that you might be interested in.   Than when you saved it,  it would 
be stored in the /etc/init.d directory and you would only than have to run 
'chkconfig --add XXX'  and finally chkconfig --level 2345 name on'.

Sound simple??


At 10:40 AM 5/18/2002 -0700, you wrote:
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

---
Ted Gervais,
Coldbrook, Nova Scotia, Canada



___
Redhat-list mailing list
[EMAIL 

RE: RedHat Scripts

2002-05-18 Thread Hugh E Cruickshank

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