File README changed (mode: 100644) (index 548acf2..6a10099) |
1 |
1 |
This is a collection of the unix tools that nobody thought to write |
This is a collection of the unix tools that nobody thought to write |
2 |
2 |
long ago, when unix was young. Currently it consists of these tools: |
long ago, when unix was young. Currently it consists of these tools: |
3 |
3 |
|
|
4 |
|
combine |
|
5 |
|
combine the lines in two files using boolean operations |
|
6 |
|
ifdata |
|
7 |
|
get network interface info without parsing ifconfig output |
|
8 |
|
isutf8 |
|
9 |
|
check if a file or standard input is utf-8 |
|
10 |
|
ifne |
|
11 |
|
run a command if the standard input is not empty |
|
12 |
|
lckdo |
|
13 |
|
execute a program with a lock held (deprecated) |
|
14 |
|
mispipe |
|
15 |
|
pipe two commands, returning the exit status of the first |
|
16 |
|
parallel |
|
17 |
|
run multiple jobs at once |
|
18 |
|
pee |
|
19 |
|
tee standard input to pipes |
|
20 |
|
sponge |
|
21 |
|
soak up standard input and write to a file |
|
22 |
|
ts |
|
23 |
|
timestamp standard input |
|
24 |
|
vidir |
|
25 |
|
edit a directory in your text editor |
|
26 |
|
vipe |
|
27 |
|
insert a text editor into a pipe |
|
28 |
|
zrun |
|
29 |
|
automatically uncompress arguments to command |
|
|
4 |
|
chronic: runs a command quietly unless it fails |
|
5 |
|
combine: combine the lines in two files using boolean operations |
|
6 |
|
ifdata: get network interface info without parsing ifconfig output |
|
7 |
|
isutf8: check if a file or standard input is utf-8 |
|
8 |
|
ifne: run a command if the standard input is not empty |
|
9 |
|
lckdo: execute a program with a lock held (deprecated) |
|
10 |
|
mispipe: pipe two commands, returning the exit status of the first |
|
11 |
|
parallel: run multiple jobs at once |
|
12 |
|
pee: tee standard input to pipes |
|
13 |
|
sponge: soak up standard input and write to a file |
|
14 |
|
ts: timestamp standard input |
|
15 |
|
vidir: edit a directory in your text editor |
|
16 |
|
vipe: insert a text editor into a pipe |
|
17 |
|
zrun: automatically uncompress arguments to command |
30 |
18 |
|
|
31 |
19 |
Its web page is here: http://kitenet.net/~joey/code/moreutils/ |
Its web page is here: http://kitenet.net/~joey/code/moreutils/ |
32 |
20 |
|
|
File chronic added (mode: 100755) (index 0000000..783b5e0) |
|
1 |
|
#!/usr/bin/perl |
|
2 |
|
|
|
3 |
|
=head1 NAME |
|
4 |
|
|
|
5 |
|
chronic - runs a command quietly unless it fails |
|
6 |
|
|
|
7 |
|
=head1 SYNOPSIS |
|
8 |
|
|
|
9 |
|
chronic COMMAND... |
|
10 |
|
|
|
11 |
|
=head1 DESCRIPTION |
|
12 |
|
|
|
13 |
|
chronic runs a command, and agganges for its standard out and standard |
|
14 |
|
error to only be displayed if the command fails (exits nonzero or crashes). |
|
15 |
|
If the command succeeds, any extraneous output will be hidden. |
|
16 |
|
|
|
17 |
|
A common use for chronic is for running a cron job. Rather than |
|
18 |
|
trying to keep the command quiet, and having to deal with mails containing |
|
19 |
|
accidental output when it succeeds, and not verbose enough output when it |
|
20 |
|
fails, you can just run it verbosely always, and use chronic to hide |
|
21 |
|
the successful output. |
|
22 |
|
|
|
23 |
|
5 0 * * * chronic rsync -v foo bar |
|
24 |
|
|
|
25 |
|
=head1 AUTHOR |
|
26 |
|
|
|
27 |
|
Copyright 2010 by Joey Hess <joey@kitenet.net> |
|
28 |
|
|
|
29 |
|
Original concept and "chronic" name by Chuck Houpt. |
|
30 |
|
|
|
31 |
|
Licensed under the GNU GPL version 2 or higher. |
|
32 |
|
|
|
33 |
|
=cut |
|
34 |
|
|
|
35 |
|
use warnings; |
|
36 |
|
use strict; |
|
37 |
|
use IPC::Run qw( start pump finish timeout ); |
|
38 |
|
|
|
39 |
|
if (! @ARGV) { |
|
40 |
|
die "usage: chronic COMMAND...\n"; |
|
41 |
|
} |
|
42 |
|
|
|
43 |
|
my ($out, $err); |
|
44 |
|
my $h = IPC::Run::start \@ARGV, \*STDIN, \$out, \$err; |
|
45 |
|
$h->finish; |
|
46 |
|
my $ret=$h->full_result; |
|
47 |
|
|
|
48 |
|
if ($ret >> 8) { # child failed |
|
49 |
|
showout(); |
|
50 |
|
exit ($ret >> 8); |
|
51 |
|
} |
|
52 |
|
elsif ($ret != 0) { # child killed by signal |
|
53 |
|
showout(); |
|
54 |
|
exit 1; |
|
55 |
|
} |
|
56 |
|
else { |
|
57 |
|
exit 0; |
|
58 |
|
} |
|
59 |
|
|
|
60 |
|
sub showout { |
|
61 |
|
print STDOUT $out; |
|
62 |
|
print STDERR $err; |
|
63 |
|
} |
File debian/changelog changed (mode: 100644) (index 232f832..958e380) |
|
1 |
|
moreutils (0.43) UNRELEASED; urgency=low |
|
2 |
|
|
|
3 |
|
* chronic: New command, runs a command quietly, unless it fails. |
|
4 |
|
* Now depends on IPC::Run, used by chronic. |
|
5 |
|
|
|
6 |
|
-- Joey Hess <joeyh@debian.org> Fri, 29 Oct 2010 15:23:17 -0400 |
|
7 |
|
|
1 |
8 |
moreutils (0.42) unstable; urgency=low |
moreutils (0.42) unstable; urgency=low |
2 |
9 |
|
|
3 |
10 |
* sponge: Guarantee that output file is always updated atomically, |
* sponge: Guarantee that output file is always updated atomically, |
File debian/control changed (mode: 100644) (index 6af7d48..451240b) |
... |
... |
Homepage: http://kitenet.net/~joey/code/moreutils/ |
9 |
9 |
|
|
10 |
10 |
Package: moreutils |
Package: moreutils |
11 |
11 |
Architecture: any |
Architecture: any |
12 |
|
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} |
|
|
12 |
|
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, libipc-run-perl |
13 |
13 |
Suggests: libtime-duration-perl, libtimedate-perl |
Suggests: libtime-duration-perl, libtimedate-perl |
14 |
14 |
Conflicts: lckdo |
Conflicts: lckdo |
15 |
15 |
Replaces: lckdo |
Replaces: lckdo |
|
... |
... |
Description: additional Unix utilities |
18 |
18 |
to write long ago, when Unix was young. |
to write long ago, when Unix was young. |
19 |
19 |
. |
. |
20 |
20 |
So far, it includes the following utilities: |
So far, it includes the following utilities: |
|
21 |
|
- chronic: runs a command quietly unless it fails |
21 |
22 |
- combine: combine the lines in two files using boolean operations |
- combine: combine the lines in two files using boolean operations |
22 |
23 |
- ifdata: get network interface info without parsing ifconfig output |
- ifdata: get network interface info without parsing ifconfig output |
23 |
24 |
- ifne: run a program if the standard input is not empty |
- ifne: run a program if the standard input is not empty |