Date: Tue, 23 Mar 2004 23:15:35 -0500 From: "Robert Spurlock" <rspurlock@lock-net.com> To: freebsd-questions@freebsd.org Subject: Restarting NATD script Message-ID: <223090-22004332441535236@lock-net.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?223090-22004332441535236>