From owner-freebsd-questions@FreeBSD.ORG Tue Mar 23 20:15:36 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4C3EC16A4CE for ; Tue, 23 Mar 2004 20:15:36 -0800 (PST) Received: from mail.lock-net.com (unknown [68.17.24.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id ECC0543D49 for ; Tue, 23 Mar 2004 20:15:35 -0800 (PST) (envelope-from rspurlock@lock-net.com) Received: from lock-net.com (mail.lock-net.com [127.0.0.1]) by mail.lock-net.com for ; Tue, 23 Mar 2004 23:15:35 -0500 Message-ID: <223090-22004332441535236@lock-net.com> X-EM-Version: 6, 0, 0, 6 X-EM-Registration: #00E0620610781F002A20 X-Priority: 3 From: "Robert Spurlock" To: freebsd-questions@freebsd.org Date: Tue, 23 Mar 2004 23:15:35 -0500 MIME-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Subject: Restarting NATD script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Mar 2004 04:15:36 -0000 I'm trying to write either a perl script or shell script to restart natd after an html script adds to the natd.conf file. The problem I've run into is after the script kills the natd process, it has to quess how long to wait before it restarts it. Here's how I'm doing it now: #!/usr/bin/perl ##Restart NATD print `kill \`cat /var/run/natd.pid\``; sleep (20); print `/sbin/natd -f /etc/natd.conf`; I need to run a loop that continuously checks for natd to be killed before it tries to run again. Since I'm doing all this remotely it causes major problems if the timing is off and it tries to restart but can't. What would be ideal is if it even checks after the restart it checks one more time to see if it fails. If it fails it could start up with a default backup natd.conf.backup file. #!/bin/ksh kill \`cat /var/run/natd.pid\` while true do if [ -z $(ps -ef |grep natd | grep -v grep) ] ; then /sbin/natd -f /etc/natd.conf fi done exit Help completing this script would be great. Thanks in advance! Rob Webmail Provided by Lock-Net Internet Services: www.lock-net.com