Merge branch 'master' of ssh://charles/tank/andrew/code/scripts
authorAndrew Lorimer <andrew@lorimer.id.au>
Thu, 10 Jan 2019 23:54:19 +0000 (10:54 +1100)
committerAndrew Lorimer <andrew@lorimer.id.au>
Thu, 10 Jan 2019 23:54:19 +0000 (10:54 +1100)
nameget.sh
postfix-delete.pl [new file with mode: 0755]
update-blocklist.sh [new file with mode: 0644]
index edc1e2e27b89c6ecf1ba30e63a96a741be2ca2a8..b0835689b9a6b181b4c3c22ace1fc3162a9a49b1 100755 (executable)
@@ -28,11 +28,15 @@ otherargs=$@                                                                                                        # set aside remaining arguments for passing to wget
 logger -s -t $LOGTAG "starting downloading files in $list"
 
 while read -r url filename; do
-  if wget --cut-dirs=100 -np -e robots=off -O $outdir$filename $otherargs $url; then
+  destarg = ''
+  if [ -n "$filename" ]; then
+    $destarg = " -O $outdir$filename"
+
+  if output=$(wget --cut-dirs=100 -np -e robots=off -P $outdir$destarg  $otherargs $url); then
                sed -i "/$filename/d" $list
                echo $filename
                logger -s -t $LOGTAG "downloaded $filename"
        else
-               logger -s -t $LOGTAG "downloading of $filename from $url failed."
+               logger -s -t $LOGTAG "downloading of $filename from $url failed: $output"
        fi
 done < $list
diff --git a/postfix-delete.pl b/postfix-delete.pl
new file mode 100755 (executable)
index 0000000..ab75701
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!";
+@data = qx</usr/sbin/postqueue -p>;
+for (@data) {
+  if (/^(\w+)(\*|\!)?\s/) {
+     $queue_id = $1;
+  }
+  if($queue_id) {
+    if (/$REGEXP/i) {
+      $Q{$queue_id} = 1;
+      $queue_id = "";
+    }
+  }
+}
+#open(POSTSUPER,"|cat") || die "couldn't open postsuper" ;
+open(POSTSUPER,"|postsuper -d -") || die "couldn't open postsuper" ;
+foreach (keys %Q) {
+  print POSTSUPER "$_\n";
+};
+close(POSTSUPER);
diff --git a/update-blocklist.sh b/update-blocklist.sh
new file mode 100644 (file)
index 0000000..2c12070
--- /dev/null
@@ -0,0 +1,10 @@
+# simple blacklist updater for OpenWRT
+
+#! /bin/sh
+set -e
+
+blacklist=https://v.firebog.net/hosts/Easylist.txt
+mkdir -p /tmp/dnsmasq-blocklist
+wget --cut-dirs=100 -np -nH -O  /tmp/dnsmasq-blocklist/ads $blacklist
+sed -i -e 's/^/0.0.0.0 /' /tmp/dnsmasq-blocklist/ads
+/etc/init.d/dnsmasq restart