Advertisement
wariat

el-notify.pl

Jan 11th, 2014
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.20 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. # el-notify-0.3
  4.  
  5. # dependencies:
  6. # dev-perl/File-Tail
  7. #     Homepage:            http://search.cpan.org/~mgrabnar/
  8. #     Description:         Perl extension for reading from
  9. #                          continously updated files
  10.  
  11. use warnings;
  12. use strict;
  13. use File::Tail;
  14.  
  15. # TU OCZYWIŚCIE WŁAŚCIWA LOKALIZACJA PLIKÓW!
  16. my $server_log = "$ENV{ HOME }/.elc/main/srv_log.txt";
  17. my $chat_log   = "$ENV{ HOME }/.elc/main/chat_log.txt";
  18.  
  19.  
  20. my $srv_logfile = File::Tail->new( name        => $server_log,
  21.                                    maxinterval => 1,
  22.                                    adjustafter => 7,
  23.                                  );
  24.  
  25.  
  26. while ( defined( $_ = $srv_logfile->read  ) ) {
  27.  
  28.     print;
  29.  
  30. # Harvest event!
  31.     if ( /You stopped harvesting/ ) {
  32. #        `notify-send -i info "Się przestało harvić się!" "Nie gap się tylko idź tam i kliknij co trzeba!"`;
  33.         `play /usr/share/sounds/freedesktop/stereo/message-new-instant.oga 2> /dev/drzewo`;
  34.         }
  35.        
  36.  
  37.  
  38. # Inwazja
  39.     `notify-send -u critical -t 0 "Inwazja!" "Tu się nie ma nad czym zastanawiać, tu trzeba spierdalać!\n$_"`
  40.         if ( /GIWS: Invasion (Advanced )?Warning!!!/ );
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement