egrep is obsolete
[myplc.git] / plc.d / dns
index 1840f32..b72b5a3 100755 (executable)
--- a/plc.d/dns
+++ b/plc.d/dns
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# priority: 850
+# priority: 950
 #
 # Start local DNS server to provide minimal DNS forward resolution for
 # ourselves and our nodes.
@@ -8,14 +8,12 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id$
-#
 
 # Source function library and configuration
 . /etc/plc.d/functions
 . /etc/planetlab/plc_config
 
-SIGNATURE="; generated by /etc/plc.d/dns --- DO NOT REMOVE THIS TEXT!"
+SIGNATURE="; generated by /etc/plc.d/dns --- DO NOT REMOVE THIS TEXT"
 
 # Be verbose
 set -x
@@ -41,7 +39,7 @@ case "$1" in
                [ -n "$PLC_NET_DNS1" ] && echo "nameserver $PLC_NET_DNS1"
                [ -n "$PLC_NET_DNS2" -a "$PLC_NET_DNS1" != "$PLC_NET_DNS2" ] && echo "nameserver $PLC_NET_DNS2"
            ) > $rfile
-           
+
            if [ $PLC_DNS_ENABLED -eq 1 ] ; then
                ourfile=$(grep "$SIGNATURE" /etc/resolv.conf| wc -l)
                if [ $ourfile -eq 0 ] ; then
@@ -68,8 +66,8 @@ case "$1" in
            dialog "$MESSAGE"
            if [ -f "/etc/plc_resolv.conf" ] ; then
                ourfile=$(grep "$SIGNATURE" /etc/plc_resolv.conf| wc -l)
-               if [ $ourfile -ne 0 ] ; then 
-                   dialog "WARNING: original /etc/resolv.conf was generated by etc/plc.d/dns"          
+               if [ $ourfile -ne 0 ] ; then
+                   dialog "WARNING: original /etc/resolv.conf was generated by etc/plc.d/dns"
                fi
                mv -f /etc/plc_resolv.conf /etc/resolv.conf
            fi
@@ -90,7 +88,7 @@ case "$1" in
        if [ $PLC_DNS_ENABLED -eq 1 ] ; then
            MESSAGE="Stopping DNS server"
            dialog "$MESSAGE"
-           killproc plc_dnsmasq
+           pkill -f plc_dnsmasq
            check
            result ""
        fi