From 3a4d91432b2f2c7d2d63627ea75fc431246c5e5f Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 8 Feb 2015 20:54:41 +0100 Subject: [PATCH] timestamp: fixed --iso. --- Makefile | 5 ++++- README | 5 +++++ rn/rn | 17 ++++++++++++++++- timestamp/timestamp | 12 +++++++----- timestamp/timestamp.1 | 4 +++- w4it-for-port-open/w4it-for-port-open | 1 + 6 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8dba773..707d782 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,11 @@ tracefile/tracefile.1: tracefile/tracefile.pod timestamp/timestamp.1: timestamp/timestamp pod2man timestamp/timestamp > timestamp/timestamp.1 +wssh/wssh.1: wssh/wssh + #pod2man wssh/wssh > wssh/wssh.1 + install: mkdir -p /usr/local/bin - parallel ln -sf `pwd`/{}/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram goodpasswd mtrr not summer timestamp transpose + parallel ln -sf `pwd`/{}/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram goodpasswd mtrr not summer timestamp transpose wssh mkdir -p /usr/local/share/man/man1 parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1 diff --git a/README b/README index 145def1..c99d07b 100644 --- a/README +++ b/README @@ -4,6 +4,8 @@ Probably not useful for you, but then again you never now. em - Force emacs to run in terminal. Use xemacs if installed. +field - Split on space. Give the given field number. Support syntax 1-3,6- + forever - Run the same command or list of commands every second. neno - No error no output. Only print STDERR and STDOUT if the command fails. @@ -16,3 +18,6 @@ stdout - Redirect both STDERR and STDOUT to STDOUT. tracefile - List files being accessed by program. +w4it-for-port-open - Block until the given port opens on a given host. + +wssh - Shorthand for w4it-for-port-open $host 22; ssh $host diff --git a/rn/rn b/rn/rn index 7f505d9..c38d10d 100755 --- a/rn/rn +++ b/rn/rn @@ -1,4 +1,19 @@ #!/bin/bash mkdir ~/.rm 2>/dev/null -mv "$@" ~/.rm +if mv "$@" ~/.rm ; then + # OK + true +else + mkdir -p ~/.rm/{1..10} + mv "$@" ~/.rm/1 2>/dev/null || + mv "$@" ~/.rm/2 2>/dev/null || + mv "$@" ~/.rm/3 2>/dev/null || + mv "$@" ~/.rm/4 2>/dev/null || + mv "$@" ~/.rm/5 2>/dev/null || + mv "$@" ~/.rm/6 2>/dev/null || + mv "$@" ~/.rm/7 2>/dev/null || + mv "$@" ~/.rm/8 2>/dev/null || + mv "$@" ~/.rm/9 2>/dev/null || + mv "$@" ~/.rm/10 +fi diff --git a/timestamp/timestamp b/timestamp/timestamp index c6a5071..5f0aceb 100755 --- a/timestamp/timestamp +++ b/timestamp/timestamp @@ -216,14 +216,17 @@ while(<>) { if($opt::rfc) { # RFC822 (actually RFC2822, as the year has 4 digits) - print strftime("%a, %d %b %Y %H:%M:%S.".$ms." %z", localtime($to_print)), " ", $_ + print strftime("%a, %d %b %Y %H:%M:%S.".$ms." %z", localtime($now)), " ", $_ } elsif($opt::iso) { # ISO8601 - print strftime("%Y-%m-%dT%H:%M:%S".$ms, localtime($to_print)), $tz , " ", $_; + print strftime("%Y-%m-%dT%H:%M:%S.".$ms, localtime($now)), $tz , " ", $_; } elsif($opt::isotime) { # ISO8601 time part only - print strftime("%H:%M:%S.".$ms, localtime($to_print)), $tz, " ", $_; + print strftime("%H:%M:%S.".$ms, localtime($now)), $tz, " ", $_; } elsif($opt::epoch) { + # Seconds since epoch + print strftime("%s.".$ms, localtime($now)), " ", $_; + } elsif(@opt::delta) { # Seconds since epoch print strftime("%s.".$ms, localtime($to_print)), " ", $_; } else { @@ -232,8 +235,7 @@ while(<>) { } sub set_defaults { - if(not($opt::rfc || $opt::iso || $opt::isotime || $opt::epoch)) { - $opt::epoch = 1; + if(not($opt::epoch || $opt::rfc || $opt::iso || $opt::isotime || $opt::epoch)) { if(not @opt::delta) { @opt::delta = (1); } diff --git a/timestamp/timestamp.1 b/timestamp/timestamp.1 index 1306290..c94e662 100644 --- a/timestamp/timestamp.1 +++ b/timestamp/timestamp.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "TIMESTAMP 1" -.TH TIMESTAMP 1 "2013-05-22" "perl v5.14.2" "User Contributed Perl Documentation" +.TH TIMESTAMP 1 "2014-02-14" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -141,6 +141,8 @@ timestamp \- prepend timestamp to output .IX Item "--delta (default)" Regard start time as epoch and thus show difference between start time and now. +.Sp +If \fB\-\-delta\fR is repeated: The time spent between each line. .IP "\fB\-\-rfc\fR" 9 .IX Item "--rfc" Output time format in \s-1RFC822\s0 (E.g. Wed, 30 Jan 2013 13:57:58 \s-1GMT\s0). diff --git a/w4it-for-port-open/w4it-for-port-open b/w4it-for-port-open/w4it-for-port-open index 44db6fc..90da417 100755 --- a/w4it-for-port-open/w4it-for-port-open +++ b/w4it-for-port-open/w4it-for-port-open @@ -33,6 +33,7 @@ if [ -z "$NC" ] ; then fi while ! is_port_open ; do + sleep 1 print_not_reachable done echo