changeset 3:afe5276c03f2 default tip

Add option to make it quieter.
author darius@midget.dons.net.au
date Sun, 25 Nov 2007 11:25:10 +1030
parents 814f41175aed
children
files update-pg
diffstat 1 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/update-pg	Sun Nov 25 10:50:36 2007 +1030
+++ b/update-pg	Sun Nov 25 11:25:10 2007 +1030
@@ -11,6 +11,37 @@
 BASE=/var/db/peerguardian
 IPSATONCE=10000
 
+args=`getopt hq $*`
+help=$?
+
+set -- $args
+quiet=0
+for i; do
+	case "$i" in
+		-q)
+		quiet=1
+		shift
+		;;
+
+		-h)
+		help=1
+		shift
+		;;
+
+		--)
+		shift
+		break
+		;;
+	esac
+done
+
+if [ $help -ne 0 ]; then
+	echo "Usage: $0 [-hq]"
+	echo "    -q: supress output on success"
+	exit 2
+fi
+
+ 
 if [ ! -w $BASE ]; then
 	echo "Can't write to $BASE, giving up" >&2
 	exit 1
@@ -26,7 +57,9 @@
 fi
 
 if [ -e $BASE/lastupdate -a ! $BASE/lastupdate -ot $BASE/p2p.php ]; then
-	echo "No update required" >&2
+    	if [ $quiet -eq 0 ]; then
+		echo "No update required" >&2
+	fi
 	exit 0
 fi