On Mon, Sep 15, 2003 at 08:21:13PM -0400, Gonzalo Avaria wrote:
> I have a little question, i would like to have a script on the startup (could 
> be init.d) that should do two command lines:
> 
> /sbin/ifconfig eth0 | fgrep -i inet | cut -d : -f 2 | cut -d \  -f 1 &> 
> ipnumero
> mail -s "IP Number" [EMAIL PROTECTED] < ipnumero
> 
> I don�t know how to do a script, and have been looking but with no success.

It depends a bit on whether you want this script to run independend of
the run level you're booting into or not. If you're happy with your
script being run for all run levels, the easiest way is to add what
you describe above to "rc.local" (it's in the /etc directory
hierarchy), probably best somewhere near the end. It will then be
executed on boot, IIRC pretty much at the end of the boot process. I
think that rc.local will not be run if you boot into single user mode,
but that's a Good Thing[tm].

If you want you're script to run only for certain runlevels, things
get slightly more complicated. The scripts as such are placed into
/etc/rc.d/init.d (if I'm not mistaken - can't check right now) and
then symbolic links are made per runlevel. I've done that once or
twice, but it's too long ago to give instructions off the top of my
head. I'm pretty certain somebody else will be able to do so.

Cheerio,

Thomas
-- 
-----------------------------------------------------------------------------
                Thomas Ribbrock    http://www.ribbrock.org 
  "You have to live on the edge of reality - to make your dreams come true!"

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to