|< 1 2 >| | 11 Einträge, 2 Seiten |
1
2
3
4
ralph@himmel:~$ while true; do echo "inputstream"; sleep 1; done | sed -e "s/^/`date` /"
Di 15. Jul 21:44:40 CEST 2008 inputstream
Di 15. Jul 21:44:40 CEST 2008 inputstream
Di 15. Jul 21:44:40 CEST 2008 inputstream
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl -w
pipe(LESE_HANDLE, SCHREIB_HANDLE);
my $Kind_pid = fork();
if ($Kind_pid) {
close(LESE_HANDLE);
my $old_handle = select(SCHREIB_HANDLE);
$| = 1;
print SCHREIB_HANDLE qx(mpstat 1 10);
close(SCHREIB_HANDLE);
wait;
select($old_handle);
} else {
close(SCHREIB_HANDLE);
my $Speicher;
while(defined($Speicher = <LESE_HANDLE>)) {
print "Empfangen: $Speicher \n";
}
exit(0);
}
open(my $mpstat, "mpstat 1 10|") or ...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/perl use strict; use warnings; my $cmd = '/usr/bin/vmstat 1 10|'; open(my $fh, $cmd) or die "Error executing vmstat: $!"; while ( my $line = <$fh> ) { print $line; print '-' x 70, "\n"; } close($fh);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
----------------------------------------------------------------------
r b swpd free buff cache si so bi bo in cs us sy id wa
----------------------------------------------------------------------
1 0 64 954680 35300 272440 0 0 11 18 43 21 3 0 97 0
----------------------------------------------------------------------
0 0 64 954176 35300 272440 0 0 0 0 1082 397 3 0 97 0
----------------------------------------------------------------------
0 0 64 954176 35300 272440 0 0 0 0 1084 397 1 0 99 0
----------------------------------------------------------------------
1 0 64 954176 35308 272440 0 0 0 48 1084 388 1 1 97 1
----------------------------------------------------------------------
0 0 64 954208 35308 272440 0 0 0 0 1084 398 2 0 98 0
----------------------------------------------------------------------
0 0 64 954208 35308 272440 0 0 0 0 1081 378 1 0 99 0
----------------------------------------------------------------------
1 0 64 954208 35308 272440 0 0 0 0 1084 395 1 1 98 0
----------------------------------------------------------------------
0 0 64 954208 35308 272440 0 0 0 0 1081 375 2 0 98 0
----------------------------------------------------------------------
0 0 64 954224 35308 272440 0 0 0 0 1084 400 1 0 99 0
----------------------------------------------------------------------
0 0 64 954224 35308 272440 0 0 0 0 1081 362 2 0 98 0
----------------------------------------------------------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl # vim: set ts=4 sw=4 et sta: use strict; use warnings; open my $pipe, './mpstat.sh |' or die "Pipe failed: $!\n"; while ( my $line = <$pipe> ) { my $time = localtime; local $, = ' '; print $time, $line; } close $pipe or die "Pipe failed: $!\n";
1
2
3
Wed Jul 16 17:29:06 2008 Wert 1
Wed Jul 16 17:29:07 2008 Wert 2
Wed Jul 16 17:29:08 2008 Wert 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl # vi:ts=4 sw=4 et: use strict; use warnings; my $cmd = '/usr/bin/vmstat 1 3'; $| = 1; open my $pipe, '-|', $cmd or die "$cmd: can't read from pipe: $!\n"; while ( my $line = <$pipe> ) { my $time = localtime; local $, = ' '; # Leerzeichen explizit angegeben (wg. Highlighting); war $" print $time, $line; } close $pipe;
|< 1 2 >| | 11 Einträge, 2 Seiten |