import torrus 1.0.9
[freeside.git] / FS / bin / freeside-check
1 #!/usr/bin/perl
2 #!/usr/bin/perl -w
3
4 use strict;
5 use FS::UID qw( adminsuidsetup );
6 use FS::Cron::check qw(
7   check_queued check_selfservice check_apache check_bop_failures
8   check_sg check_sg_login check_sgng
9   alert error_msg
10 );
11
12 my $user = shift or die &usage;
13 my @emails = @ARGV;
14 #die "no notification email given" unless @emails;
15
16 eval { adminsuidsetup $user };
17
18 if ( $@ ) { alert("Database down: $@", @emails); exit; }
19
20 check_queued       or alert('Queue daemon not running', @emails);
21 check_selfservice  or alert(error_msg(), @emails);
22 check_apache       or alert('Apache not running: '. error_msg(), @emails);
23
24 #no-ops unless you are sg
25 my $sg = 'FS::ClientAPI::SG';
26 check_sg           or alert("$sg not responding: ".     error_msg(), @emails);
27 check_sg_login     or alert("$sg login errort: ".       error_msg(), @emails);
28 check_sgng         or alert("${sg}NG not responding: ". error_msg(), @emails);
29
30 check_bop_failures or alert(error_msg(), @emails);
31