checkserver.pl
Copying Source is Forbidden
39 lines of code
1
#!/usr/local/bin/perl
2
3
# this script will return 0 if the server is undergoing maintenence
4
# and 1 when the server is live
5
6
# must have's!
7
use strict;
8
use warnings;
9
use CGI::Carp qw(fatalsToBrowser);
10
use DBI;
11
use URI::Escape;
12
13
use lib "/var/www/html/Pm";
14
15
use Bc_sql qw(sql_execute
16
user_exists
17
$QUERY_PAGE
18
$QUERY_UID
19
$LOGGEDIN
20
21
$DB
22
);
23
use Html qw(pre_html_header);
24
25
my $sql = "select * from maint";
26
my $rv = 1; # assume the server is active
27
28
if ($DB) {
29
my $result = sql_execute($sql, "checkserver.pl");
30
if ($result) {
31
if ($result->{value} eq 2) { $rv = 0; } # server is undergoing maintenence
32
}
33
}
34
35
print pre_html_header({type=>"text/plain"});
36
print $rv;
37
38
39
exit 1;