From owner-freebsd-questions@FreeBSD.ORG Mon Dec 29 22:35:12 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48129106564A for ; Mon, 29 Dec 2008 22:35:12 +0000 (UTC) (envelope-from admin2@enabled.com) Received: from typhoon.enabled.com (typhoon.enabled.com [216.218.220.21]) by mx1.freebsd.org (Postfix) with ESMTP id 3526D8FC0C for ; Mon, 29 Dec 2008 22:35:12 +0000 (UTC) (envelope-from admin2@enabled.com) Received: from [172.23.0.135] (nat-service4.juniper.net [66.129.225.151]) (authenticated bits=0) by typhoon.enabled.com (8.14.3/8.14.3) with ESMTP id mBTMZBin019827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 29 Dec 2008 14:35:11 -0800 (PST) (envelope-from admin2@enabled.com) Message-ID: <4959509A.2060506@enabled.com> Date: Mon, 29 Dec 2008 14:35:06 -0800 From: Noah User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: User Questions Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: restart rsync process via shell script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Dec 2008 22:35:12 -0000 Hi there, I am trying to figure out the most accurate way to assess if an rsync process is running and is established to the remote rsync server and is transferring data. I am writing a bourne shell script to restart rsync if the connection to the remote rsync server is lost. The command "ps ax | grep 'rsync' | grep -v grep" is not enough because the rsync and ssh process can be running but the connection to the remote server is no longer ESTABLISHED and the backup is no longer proceeding. Then perhaps the command "netstat -A | grep '192.168.1.10' | grep 'ESTABLISHED' | grep -v grep" would be helpful. But in some cases I have found that I have ssh connections to the remote rsync server that obfuscate the rsync ssh ESTABLISH statistics. the rsync command I am using is: "/usr/bin/rsync -avz '/Users/noah/' -e 'ssh -p 22' root@192.168.1.10:/Users" Any suggestions please? Cheers, Noah