From owner-freebsd-hackers@FreeBSD.ORG Sat Dec 1 16:53:58 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37C4316A420 for ; Sat, 1 Dec 2007 16:53:57 +0000 (UTC) (envelope-from andy@triera.net) Received: from md2.t-2.net (md2.t-2.net [84.255.209.71]) by mx1.freebsd.org (Postfix) with ESMTP id 024A813C457 for ; Sat, 1 Dec 2007 16:53:56 +0000 (UTC) (envelope-from andy@triera.net) Received: from [192.168.4.14] ([86.58.50.58]) by md2.t-2.net (MOS 3.8.5-GA) with ESMTP id CBE64645 (AUTH andy@t-2.net); Sat, 1 Dec 2007 17:43:51 +0100 (CET) Message-ID: <47518F54.9040000@triera.net> Date: Sat, 01 Dec 2007 17:44:04 +0100 From: Andy Rozman User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/150, host=md2.t-2.net X-Junkmail-SD-Raw: score=unknown, refid=str=0001.0A010202.47518EE3.0045,ss=1,fgs=0, ip=192.168.4.14, so=2007-07-31 18:51:00, dmn=5.4.3/2007-10-18 Subject: freebsd network problem and restarts X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2007 16:53:58 -0000 Hi ! Lately after install of new hardware, I upgraded to FreeBSD 7.0 AMD64. Problem is that every few days (5 or so) computer network connection is lost, if I restart computer everything is OK again.... What I need is script that will determine if connection is valid and if not restarting the machine. I plan to run this script by cron every hour... I am very lousy with writing scripts of anykind, so I would need little help from you... Script must do following things: 1. Check if connection is alive by pinging one site, www.google.com should be good example 2a) If connection is ok, script is finished 2b) There is no response following stuff must happen: a.) Wait for 10 minutes (or some specified time) and try step 1 again if fails following thing are done b.) Write line into log that connection is failed c.) Inject mail message to local sendmail instance (so that mail is sent after restart) d.) Reboot computer If someone knows about script that does this things, I would be very thankful if he/she could help me. If not I would be thankful for any help in creating such script. Thank you in advance. Andy