Fwd: [rhn-users] How to create startup script which start and stop certain services automatically.

Marti, Robert RJM002 at shsu.edu
Wed Jun 30 15:02:35 UTC 2010


Forwarded because it was off topic on the other list.

Horrible advice. I doubt he boots into runlevel 2. And anything being run as ana unit script should at least look like one.  Things like needing a start, stop, status...

If you don't want to write a SysV initial script dump it in /etc/rc.local

Sent from my iPhone

Begin forwarded message:

From: "Christopher L. Barnard" <cbarnard at rush.edu<mailto:cbarnard at rush.edu>>
Date: June 30, 2010 9:42:08 CDT
To: "Discussions about Red Hat Network (rhn.redhat.com<http://rhn.redhat.com>)" <rhn-users at redhat.com<mailto:rhn-users at redhat.com>>
Subject: Re: [rhn-users] How to create startup script which start and stop certain services automatically.
Reply-To: "Discussions about Red Hat Network (rhn.redhat.com<http://rhn.redhat.com>)" <rhn-users at redhat.com<mailto:rhn-users at redhat.com>>

Put it in /etc/rc2.d.

Or put "startDMS" in /etc/init.d and then create the symlink
in /etc/rc2.d that points S97startDMS -> ../init.d/startDMS.

--
Christopher L. Barnard
---------------------------------------------------------------------
Comment your code as though the maintainer will be a homicidal maniac
who knows where you live.


On Wed, 2010-06-30 at 18:54 +0530, Pravin Uttam Kharat wrote:
HI,



I couldn't understand in this procedure.
I have a created a script in vi S97startDMS. This contains following
line
/opt/DMS/ctlscript.sh start
Now  where to put this script to run at start up.


Thanks




On Tue, Jun 29, 2010 at 8:48 PM, Bill Watson <bill at magicdigits.com<mailto:bill at magicdigits.com>>
wrote:
       On Tue, 2010-06-29 at 10:44 +1000, Cameron Simpson wrote:
On 28Jun2010 10:16, Christopher L. Barnard
       <cbarnard at rush.edu<mailto:cbarnard at rush.edu>> wrote:
| On Mon, 2010-06-28 at 15:08 +0530, Pravin Uttam Kharat
       wrote:
| > I have RHEL 5 I installed Bitnami Joomla on it.I want to
       configure a
| > startup script which run that script when RHEL 5 Machine
       start and
| > automatically shut down machine on mentioned time.
       Please suggest any
| > tool for this......
|
| [ Excellent description of the SnnFOO script scheme... ]
| You can put it all in one script, and that is much easier
       for other
| individuals to understand what you are doing.  For
       'start', the script
| is called with the command line parameter of "start".
       Likewise 'stop'
| is called with the command line parameter of "stop".  So
       just switch on
| the command line parameter and you can put the script
       in /etc/init.d
| with a symlink to /etc/rc2.d/S****** and
       to /etc/rc0.d/K******

And for your second requirement, have the "start" script use
       the "at"
command to schedule a run of the "stop" script at a suitable
       time.

       Only if you want the script to be alive for a finite time.  If
       the need
       is for the app to start gracefully on system startup and stop
       gracefully
       on system shutdown, then 'at' should definitely not be used.
        If it
       should run for oh, say, the first 17 hours after powerup, then
       yes the
       at command should be used.

       --
       Christopher L. Barnard
       ---------------------------------------------------------------------
       Comment your code as though the maintainer will be a homicidal
       maniac
       who knows where you live.


       ************** I had to leave this tag line - it's too good!
       The source stated to start with the machine start and end at
       "on mentioned
       time". If the mentioned time is other than the machine shut
       down time, then
       a crontab entry calling the "K50scriptname stop" would do
       well.

       Also it seems that the "RedHat" way to do rc#.d these days is
       to place the
       file without Snn or Knn into /etc/init.d with the following
       lines at the
       top:
       #!/bin/bash
       #
       # chkconfig: - 91 35
       # description: stuff this script does comment here

       The 91 is the starting sequence within rc2.d (S91) and the 35
       is the
       stopping sequence in rc0.d (K35) and the 91 and 35 are
       adjustable to your
       needs as long as they are 2 digits each.

       Then
       chkconfig --add scriptname
       chkconfig scriptname on

       ^^^^ The above is from memory and to be taken with a grain of
       salt, lemon,
       and tequila. Hope this helps.
       Bill Watson
       <mailto:bill at magicdigits.com> bill at magicdigits.com<mailto:bill at magicdigits.com>



       _______________________________________________
       rhn-users mailing list
       <mailto:rhn-users at redhat.com> rhn-users at redhat.com<mailto:rhn-users at redhat.com>
       <https://www.redhat.com/mailman/listinfo/rhn-users> https://www.redhat.com/mailman/listinfo/rhn-users


_______________________________________________
rhn-users mailing list
rhn-users at redhat.com<mailto:rhn-users at redhat.com>
https://www.redhat.com/mailman/listinfo/rhn-users

_______________________________________________
rhn-users mailing list
rhn-users at redhat.com<mailto:rhn-users at redhat.com>
https://www.redhat.com/mailman/listinfo/rhn-users




More information about the redhat-list mailing list