Changeset 28088


Ignore:
Timestamp:
2013-08-19T23:36:12+12:00 (11 years ago)
Author:
davidb
Message:

Additional print messages added to show the decision making process activate.pl goes through

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/activate.pl

    r27325 r28088  
    192192            return 0; # return false, since the response_code was an error, expected or not
    193193        }
     194        else {
     195            &print_msg("*** Command $library_url$command\n");
     196            &print_msg("*** Unexpected error. HTTP Response Status: $response_code - Failed.\n");
     197            return 0;
     198        }
    194199    }   
    195200}
     
    621626   
    622627        &print_msg("Pinging $library_url\n");       
    623         if(&ping_library($library_url, $gs_mode, $site)) { # server running
     628        if (&ping_library($library_url, $gs_mode, $site)) { # server running
    624629       
    625630            # server is running, so release the collection if
     
    628633            $is_persistent_server = &is_persistent($library_url, $gs_mode);         
    629634           
    630             if($is_persistent_server) { # only makes sense to issue activate and deactivate cmds to a persistent server
     635            if ($is_persistent_server) { # only makes sense to issue activate and deactivate cmds to a persistent server
    631636               
    632637                &print_msg("Checking if the collection $qualified_collection is already active\n");
    633638                my $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site);
    634639
    635                 if($collection_active) {
     640                if ($collection_active) {
    636641                &print_msg("De-activating collection $qualified_collection\n");
    637642                &deactivate_collection($library_url, $gs_mode, $qualified_collection, $site);
    638643                }
    639             }   
    640         }
     644                else {
     645                &print_msg("Collection is not active => No need to deactivate\n");
     646                }
     647            }
     648            else {
     649                &print_msg("Server is not persistent => No need to deactivate collection\n");
     650            }
     651        }
     652        else {
     653            &print_msg("No response to Ping => Taken to mean server is not running\n");
     654        }
     655
    641656    }
    642657   
     
    737752       
    738753            &print_msg("Pinging $library_url\n");
    739             if(&ping_library($library_url, $gs_mode, $site)) { # server running
     754            if (&ping_library($library_url, $gs_mode, $site)) { # server running
    740755           
    741756                # don't need to work out persistency of server more than once, since the libraryURL hasn't changed             
    742                 if(!defined $is_persistent_server) {
     757                if (!defined $is_persistent_server) {
    743758                    &print_msg("Checking if Greenstone server is persistent\n");
    744759                    $is_persistent_server = &is_persistent($library_url, $gs_mode);
     
    746761               
    747762                   
    748                 if($is_persistent_server) { # persistent server, so can try activating collection
     763                if ($is_persistent_server) { # persistent server, so can try activating collection
    749764
    750765                    &print_msg("Checking if the collection $qualified_collection is not already active\n");
    751766                    my $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site);
    752767
    753                     if(!$collection_active) {
     768                    if (!$collection_active) {
    754769                    &print_msg("Activating collection $qualified_collection\n");
    755770                    &activate_collection($library_url, $gs_mode, $qualified_collection, $site);
     
    761776                    }
    762777                    }
     778                    else {
     779                    &print_msg("Collection is not active => No need to deactivate\n");
     780                    }
    763781                }
     782                else {
     783                    &print_msg("Server is not persistent => No need to deactivate collection\n");
     784                }
     785            }
     786            else {
     787                &print_msg("No response to Ping => Taken to mean server is not running\n");
    764788            }
    765789        }
Note: See TracChangeset for help on using the changeset viewer.