summaryrefslogtreecommitdiffstats
path: root/bin/control_rancid.in
diff options
context:
space:
mode:
authorTar Committer <tar@ocjtech.us>2006-05-04 21:40:56 +0000
committerTar Committer <tar@ocjtech.us>2006-05-04 21:40:56 +0000
commit1cc9f22072de1d314a67387aac57740fb25c5258 (patch)
treef59aa9d622175580add0923bfac8963dc946e98e /bin/control_rancid.in
parentc0482931956d127b5f09d4a8d72758cd4cb1f097 (diff)
downloadrancid-1cc9f22072de1d314a67387aac57740fb25c5258.tar.gz
rancid-1cc9f22072de1d314a67387aac57740fb25c5258.tar.xz
rancid-1cc9f22072de1d314a67387aac57740fb25c5258.zip
Imported from rancid-2.3.2a4.tar.gz.rancid-2.3.2a4
Diffstat (limited to 'bin/control_rancid.in')
-rw-r--r--bin/control_rancid.in35
1 files changed, 26 insertions, 9 deletions
diff --git a/bin/control_rancid.in b/bin/control_rancid.in
index 98bc630..cf601c4 100644
--- a/bin/control_rancid.in
+++ b/bin/control_rancid.in
@@ -1,6 +1,6 @@
#! /bin/sh
##
-## $Id: control_rancid.in,v 1.71 2005/08/15 00:42:50 heas Exp $
+## $Id: control_rancid.in,v 1.76 2006/05/04 21:31:20 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
@@ -114,16 +114,32 @@ then
(
echo "To: $adminmailrcpt"
echo "Subject: no $GROUP directory"
- echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
+ echo "$MAILHEADERS" | awk '{L = "";LN = $0;while (LN ~ /\\n/) { I = index(LN,"\\n");L = L substr(LN,0,I-1) "\n";LN = substr(LN,I+2,length(LN)-I-1);}print L LN;}'
echo ""
echo "$DIR does not exist."
echo "Run bin/rancid-cvs $GROUP to make all of the needed directories."
) | sendmail -t
exit 1
fi
+cd $DIR
+
+# create a .cvsignore
+if [ ! -f .cvsignore ]
+then
+ rm -f .cvsignore
+ cat >.cvsignore <<EOF
+.cvsignore
+routers.all
+routers.down
+routers.up
+EOF
+ if [ $RCSSYS = svn ]
+ then
+ svn propset svn:ignore -F .cvsignore .
+ fi
+fi
# do cvs update of router.db in case anyone has fiddled.
-cd $DIR
$RCSSYS update router.db > $TMP 2>&1
grep "^C" $TMP > /dev/null
if [ $? -eq 0 ] ; then
@@ -137,10 +153,11 @@ rm -f $TMP
if [ ! -f $DIR/router.db ]
then
+ echo "$DIR/router.db does not exist."
(
echo "To: $adminmailrcpt"
echo "Subject: no $GROUP/router.db file"
- echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
+ echo "$MAILHEADERS" | awk '{L = "";LN = $0;while (LN ~ /\\n/) { I = index(LN,"\\n");L = L substr(LN,0,I-1) "\n";LN = substr(LN,I+2,length(LN)-I-1);}print L LN;}'
echo ""
echo "$DIR/router.db does not exist."
) | sendmail -t
@@ -229,7 +246,7 @@ then
(
echo "To: $adminmailrcpt"
echo "Subject: changes in $GROUP routers"
- echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
+ echo "$MAILHEADERS" | awk '{L = "";LN = $0;while (LN ~ /\\n/) { I = index(LN,"\\n");L = L substr(LN,0,I-1) "\n";LN = substr(LN,I+2,length(LN)-I-1);}print L LN;}'
echo ""
cat routers.mail
) | sendmail -t
@@ -310,7 +327,7 @@ cd $DIR
if [ ! -s routers.up ]
then
# commit router.db
- $RCSSYS commit -m updates router.db > /dev/null
+ $RCSSYS commit -m updates router.db
exit;
fi
@@ -424,7 +441,7 @@ then
(
echo "To: $mailrcpt"
echo "Subject: $subject"
- echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
+ echo "$MAILHEADERS" | awk '{L = "";LN = $0;while (LN ~ /\\n/) { I = index(LN,"\\n");L = L substr(LN,0,I-1) "\n";LN = substr(LN,I+2,length(LN)-I-1);}print L LN;}'
echo ""
cat $TMP.diff
) | sendmail -t
@@ -444,7 +461,7 @@ then
(
echo "To: $adminmailrcpt"
echo "Subject: config fetcher problems - $GROUP"
- echo "$MAILHEADERS" | awk '{gsub(/\\n/,"\n");print;}'
+ echo "$MAILHEADERS" | awk '{L = "";LN = $0;while (LN ~ /\\n/) { I = index(LN,"\\n");L = L substr(LN,0,I-1) "\n";LN = substr(LN,I+2,length(LN)-I-1);}print L LN;}'
echo ""
echo "The following routers have not been successfully contacted for"
echo "more than $OLDTIME hours."
@@ -454,5 +471,5 @@ then
fi
# Cleanup
-rm -f $TMP.diff $DIR/routers.single
+rm -f $TMP.diff $DIR/routers.single $DIR/routers.failed
trap '' 1 2 15