[Bio] / FigWebServices / server_check.cgi Repository:
ViewVC logotype

Annotation of /FigWebServices/server_check.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (view) (download)

1 : olson 1.1 #
2 : olson 1.3 # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 :     #
19 : olson 1.1 # Check to see if the SEED server is up and running.
20 :     #
21 :    
22 :     use FIG;
23 :     use CGI;
24 :     use strict;
25 :    
26 :     my $cgi = new CGI;
27 :    
28 : olson 1.2 if ($cgi->param('error'))
29 :     {
30 :     my $err = $cgi->param('error');
31 :    
32 :     print $cgi->header(-status => "500 Error forced $err");
33 :    
34 :     print $cgi->p("Error forced $err");
35 :     exit();
36 :     }
37 :    
38 : olson 1.1 my $fig;
39 :     eval {
40 :     $fig = new FIG;
41 :     };
42 :    
43 :     if ($@)
44 :     {
45 :     my $err = $@;
46 :     #
47 :     # Cannot create a FIG, often happens if the database is down.
48 :     #
49 :    
50 :     if ($err =~ /Could not connect to DBI:.*could not connect to server/)
51 :     {
52 :     print $cgi->header(-status => "501 Database not available $FIG_Config::dbms $FIG_Config::db $FIG_Config::dbport");
53 :     print $cgi->p("Could not connect to relational database of type $FIG_Config::dbms named $FIG_Config::db on port $FIG_Config::dbport.");
54 :     }
55 :     else
56 :     {
57 :     my $e = $err;
58 :     $e =~ s/\n.*$//;
59 :     print $cgi->header(-status => "502 Error constructing FIG: $e");
60 :     print $cgi->p("Could not construct fig object:");
61 :     print $cgi->pre($err);
62 :     }
63 :    
64 :     exit();
65 :     }
66 :    
67 :     print $cgi->header();
68 :     print $cgi->p("Server OK");
69 :     print "\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3