Re: How to create startup script which start and stop certain services automatically.

Pravin Uttam Kharat <[email protected]> Wed, 30 Jun 2010 18:54:23 +0530
Newsgroups gmane.linux.redhat.rhn.user
Message-ID <[email protected]>
--===============1180603277930250302==
Content-Type: multipart/alternative; boundary=0015175caa24aaffab048a3f455f

--0015175caa24aaffab048a3f455f
Content-Type: text/plain; charset=ISO-8859-1

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 <[email protected]> wrote:

> On Tue, 2010-06-29 at 10:44 +1000, Cameron Simpson wrote:
> > On 28Jun2010 10:16, Christopher L. Barnard <[email protected]> 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
> [email protected]
>
>
>
> _______________________________________________
> rhn-users mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/rhn-users
>

--0015175caa24aaffab048a3f455f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>HI,<br></div><div><br></div><div>I couldn&#39;t understand in this pro=
cedure.</div><div>I have a created a script in vi S97startDMS. This contain=
s following line</div><div>/opt/DMS/ctlscript.sh start</div><div>Now =A0whe=
re to put this script to run at start up.</div>
<div><br></div><div>Thanks</div><div><br></div><div>=A0</div><br><div class=
=3D"gmail_quote">On Tue, Jun 29, 2010 at 8:48 PM, Bill Watson <span dir=3D"=
ltr">&lt;<a href=3D"mailto:[email protected]">[email protected]</a>&g=
t;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex;"><div><div class=3D"h5">On Tue, 2010-06-29 a=
t 10:44 +1000, Cameron Simpson wrote:<br>
&gt; On 28Jun2010 10:16, Christopher L. Barnard &lt;<a href=3D"mailto:cbarn=
[email protected]">[email protected]</a>&gt; wrote:<br>
&gt; | On Mon, 2010-06-28 at 15:08 +0530, Pravin Uttam Kharat wrote:<br>
&gt; | &gt; I have RHEL 5 I installed Bitnami Joomla on it.I want to config=
ure a<br>
&gt; | &gt; startup script which run that script when RHEL 5 Machine start =
and<br>
&gt; | &gt; automatically shut down machine on mentioned time. Please sugge=
st any<br>
&gt; | &gt; tool for this......<br>
&gt; |<br>
&gt; | [ Excellent description of the SnnFOO script scheme... ]<br>
&gt; | You can put it all in one script, and that is much easier for other<=
br>
&gt; | individuals to understand what you are doing. =A0For &#39;start&#39;=
, the script<br>
&gt; | is called with the command line parameter of &quot;start&quot;. =A0 =
Likewise &#39;stop&#39;<br>
&gt; | is called with the command line parameter of &quot;stop&quot;. =A0So=
 just switch on<br>
&gt; | the command line parameter and you can put the script in /etc/init.d=
<br>
&gt; | with a symlink to /etc/rc2.d/S****** and to /etc/rc0.d/K******<br>
&gt;<br>
&gt; And for your second requirement, have the &quot;start&quot; script use=
 the &quot;at&quot;<br>
&gt; command to schedule a run of the &quot;stop&quot; script at a suitable=
 time.<br>
<br>
Only if you want the script to be alive for a finite time. =A0If the need<b=
r>
is for the app to start gracefully on system startup and stop gracefully<br=
>
on system shutdown, then &#39;at&#39; should definitely not be used. =A0If =
it<br>
should run for oh, say, the first 17 hours after powerup, then yes the<br>
at command should be used.<br>
<br>
--<br>
Christopher L. Barnard<br>
---------------------------------------------------------------------<br>
Comment your code as though the maintainer will be a homicidal maniac<br>
who knows where you live.<br>
<br>
</div></div>************** I had to leave this tag line - it&#39;s too good=
!<br>
The source stated to start with the machine start and end at &quot;on menti=
oned<br>
time&quot;. If the mentioned time is other than the machine shut down time,=
 then<br>
a crontab entry calling the &quot;K50scriptname stop&quot; would do well.<b=
r>
<br>
Also it seems that the &quot;RedHat&quot; way to do rc#.d these days is to =
place the<br>
file without Snn or Knn into /etc/init.d with the following lines at the<br=
>
top:<br>
#!/bin/bash<br>
#<br>
# chkconfig: - 91 35<br>
# description: stuff this script does comment here<br>
<br>
The 91 is the starting sequence within rc2.d (S91) and the 35 is the<br>
stopping sequence in rc0.d (K35) and the 91 and 35 are adjustable to your<b=
r>
needs as long as they are 2 digits each.<br>
<br>
Then<br>
chkconfig --add scriptname<br>
chkconfig scriptname on<br>
<br>
^^^^ The above is from memory and to be taken with a grain of salt, lemon,<=
br>
and tequila. Hope this helps.<br>
<font color=3D"#888888">Bill Watson<br>
<a href=3D"mailto:[email protected]">[email protected]</a><br>
</font><div><div class=3D"h5"><br>
<br>
<br>
_______________________________________________<br>
rhn-users mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]</a><br>
<a href=3D"https://www.redhat.com/mailman/listinfo/rhn-users" target=3D"_bl=
ank">https://www.redhat.com/mailman/listinfo/rhn-users</a><br>
</div></div></blockquote></div><br>

--0015175caa24aaffab048a3f455f--


--===============1180603277930250302==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
rhn-users mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhn-users
--===============1180603277930250302==--