--On Sunday, June 29, 2003 7:01 PM +0000 Eric Liu <[EMAIL PROTECTED]> wrote:

I want to write a alert script to restart network service under redhat
7.3,  How can I write the script. BTW can I write alert script to reboot
remote computer when I found it is necessary, if it is reasonable How can
i do that?


I'm going to assume you know how to write simple unix scripts, either sh or perl. So I'll just point you in the right direction. (In general, I'd say that if you can't write simple scripts, you probably shouldn't be using Mon. At least not for anything complex.)


RedHat provides two simple to use scripts, '/sbin/ifup', and '/sbin/ifdown', which can be used to enable and disable an interface. So write a simple script that runs '/sbin/ifdown eth0', waits a few seconds, and then runs '/sbin/ifup eth0'. Better yet, have it take the interface name from the command line, and then have your mon config line say something like:
alert restart-interface.alert eth0



Your other problem is much more complex. How do you remotely reboot a crashed machine? (If the machine isn't crashed, you probably want to just restart the specific service, not reboot the machine. Except of course for Microsoft OS's, where the best answer is usually a reboot. :)


The only ways to do it that I've seen involve remotely managable power switches or UPS's.

Some such devices exist which can be plugged directly into the network, and can turn their power ports off and on in response to network packets (SNMP, or other protocols). But you should obviously seriously consider the security ramifications of those devices. (Make sure those devices are filtered at your firewall, and maybe even filter access to them at your routers from any machine other then the machines you expect to send them packets.)

Other devices exist which have serial control interfaces. These are obviously much less of a security risk, but much more of a management hassle. (Extra cabling, all routed to central terminal servers, etc.)

-David

David Nolan                    <*>                    [EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
     a herd of rogue emacs fsck your troff and vgrind your pathalias!
_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to