linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* start up script
@ 2003-02-11 23:05 - Luis -
  2003-02-12  7:23 ` Glynn Clements
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: - Luis - @ 2003-02-11 23:05 UTC (permalink / raw)
  To: linux admin

Hi all, i want to add a script to the start up in my Red Hat box, but i 
already put the file in /etc/rc.d/init.d and make the symbolic link in 
/etc/rc3.d/S55routetable.

But still doesn't work, if i run the script manually, it runs just fine, but 
when i restart the server i doesn't run.  

Basically the script is for adding some routes to my server.

Thanks
-- 
Luis Valencia
------------------------
With a PC, I always felt limited
by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-11 23:05 start up script - Luis -
@ 2003-02-12  7:23 ` Glynn Clements
  2003-02-12  8:35 ` freddie
  2003-02-12 11:24 ` terry white
  2 siblings, 0 replies; 12+ messages in thread
From: Glynn Clements @ 2003-02-12  7:23 UTC (permalink / raw)
  To: - Luis -; +Cc: linux admin


- Luis - wrote:

> Hi all, i want to add a script to the start up in my Red Hat box, but i 
> already put the file in /etc/rc.d/init.d and make the symbolic link in 
> /etc/rc3.d/S55routetable.

It should probably be "/etc/rc.d/rc3.d/S55routetable".

> But still doesn't work, if i run the script manually, it runs just fine, but 
> when i restart the server i doesn't run.  

Is the script relying upon environment settings which are only present
in an interactive shell? Scripts which are run from init tend to have
a relatively empty environment; e.g. PATH may not contain /sbin or
/usr/sbin, etc.

Does the script work if you use e.g.

	env -i /etc/rc.d/init.d/routetable start

?

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-11 23:05 start up script - Luis -
  2003-02-12  7:23 ` Glynn Clements
@ 2003-02-12  8:35 ` freddie
  2003-02-12 11:24 ` terry white
  2 siblings, 0 replies; 12+ messages in thread
From: freddie @ 2003-02-12  8:35 UTC (permalink / raw)
  To: - Luis -; +Cc: linux admin

does your script start with #!/bin/bash (or equivalent)?
also use full paths. for example in your script "sed blahblahblah" will 
work when you run it by hand but not during boot. "/usr/sbin/sed 
balhblahblah" would work for both.
when you run something manually you have your whole environment set up. 
when a script is run during bootup it doesnt.


> Hi all, i want to add a script to the start up in my Red Hat box, but
> i
> already put the file in /etc/rc.d/init.d and make the symbolic link in
> 
> /etc/rc3.d/S55routetable.
> 
> But still doesn't work, if i run the script manually, it runs just
> fine, but
> when i restart the server i doesn't run.
> 
> Basically the script is for adding some routes to my server.
> 
> Thanks
> --
> Luis Valencia
> ------------------------
> With a PC, I always felt limited
> by the software available.
> On Unix, I am limited only by my knowledge.
> --Peter J. Schoenster
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-11 23:05 start up script - Luis -
  2003-02-12  7:23 ` Glynn Clements
  2003-02-12  8:35 ` freddie
@ 2003-02-12 11:24 ` terry white
  2003-02-12 14:38   ` - Luis -
  2 siblings, 1 reply; 12+ messages in thread
From: terry white @ 2003-02-12 11:24 UTC (permalink / raw)
  To: linux-admin

on "2-11-2003" "- Luis -" writ:

: Hi all, i want to add a script to the start up in my Red Hat box, but i
: already put the file in /etc/rc.d/init.d and make the symbolic link in
: /etc/rc3.d/S55routetable.
:
: But still doesn't work, if i run the script manually, it runs just fine, but
: when i restart the server i doesn't run.

... did you use 'chkconfig' to enable it ...


-- 
... i'm a man, but i can change,
    if i have to , i guess ...


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 11:24 ` terry white
@ 2003-02-12 14:38   ` - Luis -
  2003-02-12 15:33     ` Scott Taylor
                       ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: - Luis - @ 2003-02-12 14:38 UTC (permalink / raw)
  To: linux-admin

This is my script:

#!/bin/bash
/sbin/route add -net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
/sbin/route add -net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
/sbin/route add -net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250

and its place in /etc/rc.d/init.d/routetable and the link its in 
/etc/rc.d/rc3.d/S55routetable

but i run it only executing /etc/rc.d/init.d/routetable as root

how does it work chkconfig? or do i have to place this script in somewhere 
else?

Thanks

On Wednesday 12 February 2003 05:24, terry white wrote:
> on "2-11-2003" "- Luis -" writ:
> : Hi all, i want to add a script to the start up in my Red Hat box, but i
> : already put the file in /etc/rc.d/init.d and make the symbolic link in
> : /etc/rc3.d/S55routetable.
> :
> : But still doesn't work, if i run the script manually, it runs just fine,
> : but when i restart the server i doesn't run.
>
> ... did you use 'chkconfig' to enable it ...

-- 
Luis Valencia
------------------------
With a PC, I always felt limited
by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 14:38   ` - Luis -
@ 2003-02-12 15:33     ` Scott Taylor
  2003-02-12 17:45       ` - Luis -
  2003-02-12 16:07     ` terry white
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Scott Taylor @ 2003-02-12 15:33 UTC (permalink / raw)
  To: linux-admin

At 06:38 AM 2/12/03, - Luis - wrote:
>This is my script:
>
>#!/bin/bash
>/sbin/route add -net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
>/sbin/route add -net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
>/sbin/route add -net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250
>
>and its place in /etc/rc.d/init.d/routetable and the link its in
>/etc/rc.d/rc3.d/S55routetable

There is more to writing a startup script than that.

>but i run it only executing /etc/rc.d/init.d/routetable as root

I don't think it should make a difference at this point, unless your 
network isn't running by S55.  Are you sure you are starting only at run 
level 3?

>how does it work chkconfig? or do i have to place this script in somewhere
>else?

man chkconfig
It's a very handy tool for administering run level services.

Didn't you say you were running a RedHat box?  Version number would be 
useful information, however, check to see if you have the file:
  /etc/sysconfig/static-routes

in it, add the line:
eth0 net 10.0.0.0 netmask 255.0.0.0 gw 10.1.1.250

>As long as eth0 is the NIC connected to 10.1.1.250

/etc/init.d/network script reads this file for you, and does it in the 
right place, and the next person to admin this RedHat box will know where 
to look with out a bunch of fumbling around.

Good luck.

Scott.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 14:38   ` - Luis -
  2003-02-12 15:33     ` Scott Taylor
@ 2003-02-12 16:07     ` terry white
  2003-02-12 22:14     ` Glynn Clements
  2003-02-12 22:21     ` Andrew B. Cramer
  3 siblings, 0 replies; 12+ messages in thread
From: terry white @ 2003-02-12 16:07 UTC (permalink / raw)
  To: linux-admin

... ciao:

    "man chkconfig" is the first thing to do.

    basically, chkconfig manages services when the runlevel changes.  it
requires a file for each service it manages, and that file has a specific
format.  that format is defined (RH at least) in 'sysvinitfiles'.  a
"locate sysvinitfiles" should point you in the right direction.  the file
makes a handy template, for the cut-n-paste advocate.

    given your preference, the file you create will be called
'routetable', and "chkconfig --add routetable" should handle all the
housekeeping chores.  however, the file supports a 'case' statement
allowing several possible invocations, and it is your responsibility to
provide for the ones you use.  specifically, you might well consider
using a 'route -del blah' to remove routes you've created when the
interface comes down.


: the link its in /etc/rc.d/rc3.d/S55routetable

    i'd rm that before you invoke chkconfig on 'routetable' ...


-- 
... i'm a man, but i can change,
    if i have to , i guess ...


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 15:33     ` Scott Taylor
@ 2003-02-12 17:45       ` - Luis -
  2003-02-12 18:09         ` Jeff Largent
  0 siblings, 1 reply; 12+ messages in thread
From: - Luis - @ 2003-02-12 17:45 UTC (permalink / raw)
  To: linux admin

Thanks Scott, that static-routes file will make my day, but i look in 
/etc/sysconfig and is not there, can i just create one and restart the 
network services, or is more complicated than that?


On Wednesday 12 February 2003 09:33, Scott Taylor wrote:
> At 06:38 AM 2/12/03, - Luis - wrote:
> >This is my script:
> >
> >#!/bin/bash
> >/sbin/route add -net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
> >/sbin/route add -net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
> >/sbin/route add -net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250
> >
> >and its place in /etc/rc.d/init.d/routetable and the link its in
> >/etc/rc.d/rc3.d/S55routetable
>
> There is more to writing a startup script than that.
>
> >but i run it only executing /etc/rc.d/init.d/routetable as root
>
> I don't think it should make a difference at this point, unless your
> network isn't running by S55.  Are you sure you are starting only at run
> level 3?
>
> >how does it work chkconfig? or do i have to place this script in somewhere
> >else?
>
> man chkconfig
> It's a very handy tool for administering run level services.
>
> Didn't you say you were running a RedHat box?  Version number would be
> useful information, however, check to see if you have the file:
>   /etc/sysconfig/static-routes
>
> in it, add the line:
> eth0 net 10.0.0.0 netmask 255.0.0.0 gw 10.1.1.250
>
> >As long as eth0 is the NIC connected to 10.1.1.250
>
> /etc/init.d/network script reads this file for you, and does it in the
> right place, and the next person to admin this RedHat box will know where
> to look with out a bunch of fumbling around.
>
> Good luck.
>
> Scott.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Luis Valencia
------------------------
With a PC, I always felt limited
by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 17:45       ` - Luis -
@ 2003-02-12 18:09         ` Jeff Largent
  2003-02-12 18:29           ` - Luis -
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Largent @ 2003-02-12 18:09 UTC (permalink / raw)
  To: - Luis -; +Cc: linux admin

The static-routes file based on your route statements would look
like:
eth0 net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
ech0 net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
eth0 net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250

the answer is yes if the file dosn't exist create it and
just restart network "service network restart"

Jeff

- Luis - wrote:
> Thanks Scott, that static-routes file will make my day, but i look in 
> /etc/sysconfig and is not there, can i just create one and restart the 
> network services, or is more complicated than that?
> 
> 
> On Wednesday 12 February 2003 09:33, Scott Taylor wrote:
> 
>>At 06:38 AM 2/12/03, - Luis - wrote:
>>
>>>This is my script:
>>>
>>>#!/bin/bash
>>>/sbin/route add -net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
>>>/sbin/route add -net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
>>>/sbin/route add -net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250
>>>
>>>and its place in /etc/rc.d/init.d/routetable and the link its in
>>>/etc/rc.d/rc3.d/S55routetable
>>
>>There is more to writing a startup script than that.
>>
>>
>>>but i run it only executing /etc/rc.d/init.d/routetable as root
>>
>>I don't think it should make a difference at this point, unless your
>>network isn't running by S55.  Are you sure you are starting only at run
>>level 3?
>>
>>
>>>how does it work chkconfig? or do i have to place this script in somewhere
>>>else?
>>
>>man chkconfig
>>It's a very handy tool for administering run level services.
>>
>>Didn't you say you were running a RedHat box?  Version number would be
>>useful information, however, check to see if you have the file:
>>  /etc/sysconfig/static-routes
>>
>>in it, add the line:
>>eth0 net 10.0.0.0 netmask 255.0.0.0 gw 10.1.1.250
>>
>>
>>>As long as eth0 is the NIC connected to 10.1.1.250
>>
>>/etc/init.d/network script reads this file for you, and does it in the
>>right place, and the next person to admin this RedHat box will know where
>>to look with out a bunch of fumbling around.
>>
>>Good luck.
>>
>>Scott.
>>
>>
>>-
>>To unsubscribe from this list: send the line "unsubscribe linux-admin" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

-- 
Jeff Largent                   ImageLinks, Inc.
Sr System Admin                Melbourne, Fl 32935
(321) 253-0011                 fax:(321) 253-5559


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 18:09         ` Jeff Largent
@ 2003-02-12 18:29           ` - Luis -
  0 siblings, 0 replies; 12+ messages in thread
From: - Luis - @ 2003-02-12 18:29 UTC (permalink / raw)
  To: linux admin

Thanks, that solve my problem


On Wednesday 12 February 2003 12:09, you wrote:
> The static-routes file based on your route statements would look
> like:
> eth0 net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
> ech0 net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
> eth0 net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250
>
> the answer is yes if the file dosn't exist create it and
> just restart network "service network restart"
>
> Jeff
>
> - Luis - wrote:
> > Thanks Scott, that static-routes file will make my day, but i look in
> > /etc/sysconfig and is not there, can i just create one and restart the
> > network services, or is more complicated than that?
> >
> > On Wednesday 12 February 2003 09:33, Scott Taylor wrote:
> >>At 06:38 AM 2/12/03, - Luis - wrote:
> >>>This is my script:
> >>>
> >>>#!/bin/bash
> >>>/sbin/route add -net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
> >>>/sbin/route add -net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
> >>>/sbin/route add -net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250
> >>>
> >>>and its place in /etc/rc.d/init.d/routetable and the link its in
> >>>/etc/rc.d/rc3.d/S55routetable
> >>
> >>There is more to writing a startup script than that.
> >>
> >>>but i run it only executing /etc/rc.d/init.d/routetable as root
> >>
> >>I don't think it should make a difference at this point, unless your
> >>network isn't running by S55.  Are you sure you are starting only at run
> >>level 3?
> >>
> >>>how does it work chkconfig? or do i have to place this script in
> >>> somewhere else?
> >>
> >>man chkconfig
> >>It's a very handy tool for administering run level services.
> >>
> >>Didn't you say you were running a RedHat box?  Version number would be
> >>useful information, however, check to see if you have the file:
> >>  /etc/sysconfig/static-routes
> >>
> >>in it, add the line:
> >>eth0 net 10.0.0.0 netmask 255.0.0.0 gw 10.1.1.250
> >>
> >>>As long as eth0 is the NIC connected to 10.1.1.250
> >>
> >>/etc/init.d/network script reads this file for you, and does it in the
> >>right place, and the next person to admin this RedHat box will know where
> >>to look with out a bunch of fumbling around.
> >>
> >>Good luck.
> >>
> >>Scott.
> >>
> >>
> >>-
> >>To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> >>the body of a message to majordomo@vger.kernel.org
> >>More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Luis Valencia
------------------------
With a PC, I always felt limited
by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 14:38   ` - Luis -
  2003-02-12 15:33     ` Scott Taylor
  2003-02-12 16:07     ` terry white
@ 2003-02-12 22:14     ` Glynn Clements
  2003-02-12 22:21     ` Andrew B. Cramer
  3 siblings, 0 replies; 12+ messages in thread
From: Glynn Clements @ 2003-02-12 22:14 UTC (permalink / raw)
  To: - Luis -; +Cc: linux-admin


- Luis - wrote:

> how does it work chkconfig? or do i have to place this script in somewhere 
> else?

chkconfig just adds and removes the symlinks. It relies upon the
script having a line like this:

	# chkconfig: 2345 05 92

near the top of the script.

The first field ("2345") is the default list of runlevels for which
that script will be run. The second field is the start order, and
the third is the stop order (i.e. the numbers in the "S" and "K"
symlinks respectively).

chkconfig is just for convenience. You don't have to use chkconfig;
creating the symlink manually will work just as well.

-- 
Glynn Clements <glynn.clements@virgin.net>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: start up script
  2003-02-12 14:38   ` - Luis -
                       ` (2 preceding siblings ...)
  2003-02-12 22:14     ` Glynn Clements
@ 2003-02-12 22:21     ` Andrew B. Cramer
  3 siblings, 0 replies; 12+ messages in thread
From: Andrew B. Cramer @ 2003-02-12 22:21 UTC (permalink / raw)
  To: - Luis -, linux-admin


Hi,
	I use this, and call it rc.myroutes. It's for 2 network cards. 
Running Slackware.

#! /bin/sh
/sbin/route add -net 192.168.0.128 gw 192.168.0.130 netmask 
255.255.255.128
/sbin/route add -net 192.168.0.0 gw 192.168.0.1 netmask 
255.255.255.128 
#

Best - Andrew

On 12 Feb 2003 at 8:38, - Luis - wrote:

> This is my script:
> 
> #!/bin/bash
> /sbin/route add -net 10.3.1.0 netmask 255.255.255.0 gw 10.1.1.250
> /sbin/route add -net 10.4.1.0 netmask 255.255.255.0 gw 10.1.1.250
> /sbin/route add -net 10.8.1.0 netmask 255.255.255.0 gw 10.1.1.250
> 
> and its place in /etc/rc.d/init.d/routetable and the link its in 
> /etc/rc.d/rc3.d/S55routetable
> 
> but i run it only executing /etc/rc.d/init.d/routetable as root
> 
> how does it work chkconfig? or do i have to place this script in somewhere 
> else?
> 
> Thanks
> 
> On Wednesday 12 February 2003 05:24, terry white wrote:
> > on "2-11-2003" "- Luis -" writ:
> > : Hi all, i want to add a script to the start up in my Red Hat box, but i
> > : already put the file in /etc/rc.d/init.d and make the symbolic link in
> > : /etc/rc3.d/S55routetable.
> > :
> > : But still doesn't work, if i run the script manually, it runs just fine,
> > : but when i restart the server i doesn't run.
> >
> > ... did you use 'chkconfig' to enable it ...
> 
> -- 
> Luis Valencia
> ------------------------
> With a PC, I always felt limited
> by the software available.
> On Unix, I am limited only by my knowledge.
> --Peter J. Schoenster
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-02-12 22:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-11 23:05 start up script - Luis -
2003-02-12  7:23 ` Glynn Clements
2003-02-12  8:35 ` freddie
2003-02-12 11:24 ` terry white
2003-02-12 14:38   ` - Luis -
2003-02-12 15:33     ` Scott Taylor
2003-02-12 17:45       ` - Luis -
2003-02-12 18:09         ` Jeff Largent
2003-02-12 18:29           ` - Luis -
2003-02-12 16:07     ` terry white
2003-02-12 22:14     ` Glynn Clements
2003-02-12 22:21     ` Andrew B. Cramer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).