Skip to content

Commit 397df48

Browse files
brablcOndrej Brablc
authored andcommitted
Accumulated changes
1 parent 4f81e98 commit 397df48

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

chkurl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ if [[ $1 == '-r' ]]; then
55
RECURSE=1
66
fi
77
URL=${1?Usage: $0 [-r] <URL>}
8-
read URL RETCODE NEWURL < <(curl -o /dev/null --silent --head --write-out "$URL %{http_code} %{redirect_url}\n" "$URL")
9-
echo $URL $RETCODE $NEWURL
8+
read URL RETCODE TTTL NEWURL < <(curl -o /dev/null --silent --head --write-out "$URL %{http_code} %{time_total} %{redirect_url}\n" "$URL")
9+
echo $URL $RETCODE $TTTL $NEWURL
1010
if [[ $RECURSE == 1 && ( $RETCODE == '301' || $RETCODE == '302' ) ]]; then
1111
$0 -r $NEWURL
1212
fi

ip2host

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ perl -MSocket -plane '
44
BEGIN {
55
%CACHE=();
66
sub gethost {
7-
$ip = join( ".", unpack "C4", pack "N", $1);
7+
$ip = $1;
88
unless (defined $CACHE{$ip}) {
9-
@name = gethostbyaddr(inet_aton($1),AF_INET);
10-
$CACHE{$ip} = $name[0] ? $name[0] : $1;
9+
@name = gethostbyaddr(inet_aton($ip),AF_INET);
10+
$CACHE{$ip} = $name[0] ? $name[0] : $ip;
1111
}
1212
return $CACHE{$ip};
1313
}
1414
}
15-
s/\b(([0-9]{1,3}\.){3}([0-9]{1,3}))\b/gethost($1)/eg;
15+
s/\b(([0-9]{1,3}\.){3}([0-9]{1,3}))\b/$1." ".gethost($1)/eg;
1616
'

ipinfo

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
curl -s ipinfo.io/$1 | jq .

postqueuefmt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
#!/usr/bin/perl
22

3-
while (<POSTQUEUE>) {
3+
while (<>) {
44
if (/^(\w+)(\*|\!)?\s/) {
5+
$header = $_;
56
$queue_id = $1;
6-
$_ = <POSTQUEUE>;
7+
$_ = <>;
78
chop;
89
$msg = $_;
910

1011
if (/^\(.*(\d{3}) (\d.\d.\d) .*\)$/) {
1112
$reply = $1;
1213
$error = $2;
1314

14-
$_ = <POSTQUEUE>;
15+
$_ = <>;
1516
chop;
1617
s/\s+//g;
1718
$email = $_;
1819

1920
print "$queue_id $reply $error $email $msg\n";
21+
} elsif ($header =~ /MAILER-DAEMON/) {
22+
print "$queue_id -- MAILER-DAEMON\n";
23+
} else {
24+
print "$queue_id -- PARSE-ERROR\n";
2025
}
2126
}
2227
}
23-
24-
close(POSTQUEUE);

0 commit comments

Comments
 (0)