Last change
on this file since 665 was
665,
checked in by quentin, 17 years ago
|
Make Zephyrs more useful and move to -c scripts-auto
|
-
Property svn:executable set to
*
|
File size:
764 bytes
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use Sys::Hostname; |
---|
6 | |
---|
7 | sub sendmsg($;$$) { |
---|
8 | my ($message, $class, $instance) = @_; |
---|
9 | $class ||= "scripts-auto"; |
---|
10 | $instance ||= 'root.'.hostname; |
---|
11 | open(ZWRITE, "|-", qw|/usr/bin/zwrite -d -c|, $class, '-i', $instance, '-s', hostname) or die "Couldn't open zwrite"; |
---|
12 | print ZWRITE $message; |
---|
13 | close(ZWRITE); |
---|
14 | } |
---|
15 | |
---|
16 | my $last; |
---|
17 | |
---|
18 | while (my $message = <>) { |
---|
19 | chomp $message; |
---|
20 | $message =~ s/^(.*?): //; |
---|
21 | if ($message =~ m|Accepted (\S+) for (\S+)|) { |
---|
22 | my $send = $message; |
---|
23 | if ($1 eq "gssapi-with-mic") { |
---|
24 | $send = $last."\n".$send; |
---|
25 | } |
---|
26 | if ($2 eq "root" or $2 eq "logview") { |
---|
27 | sendmsg($send); |
---|
28 | } |
---|
29 | } elsif ($message =~ m|session \S+ for user root |) { |
---|
30 | sendmsg($message); |
---|
31 | } |
---|
32 | |
---|
33 | $last = $message; |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.