check_users.t 731 B

12345678910111213141516171819202122232425262728
  1. #! /usr/bin/perl -w -I ..
  2. #
  3. # Logged in Users Tests via check_users
  4. #
  5. # Trick: This ckeck requires at least 1 user logged in. These commands should
  6. # leave a session open forever in the background:
  7. #
  8. # $ ssh -tt localhost </dev/null >/dev/null 2>/dev/null &
  9. # $ disown %1
  10. use strict;
  11. use Test;
  12. use NPTest;
  13. use vars qw($tests);
  14. BEGIN {$tests = 4; plan tests => $tests}
  15. my $successOutput = '/^USERS OK - [0-9]+ users currently logged in/';
  16. my $failureOutput = '/^USERS CRITICAL - [0-9]+ users currently logged in/';
  17. my $t;
  18. $t += checkCmd( "./check_users 1000 1000", 0, $successOutput );
  19. $t += checkCmd( "./check_users 0 0", 2, $failureOutput );
  20. exit(0) if defined($Test::Harness::VERSION);
  21. exit($tests - $t);