Ignore:
Timestamp:
2009-12-07T12:07:11+13:00 (14 years ago)
Author:
davidb
Message:

Changed start and stop Derby DB to perl code

File:
1 copied

Legend:

Unmodified
Added
Removed
  • gs3-extensions/pharos/trunk/bin/script/pharos-start-derby.pl

    r21274 r21275  
    1 #!/bin/bash
     1#!/usr/bin/perl -w
    22
    3 derbyjar_dir=$PHAROSIS_HOME/WEB-INF/lib
     3###########################################################################
     4#
     5# pharos-start-derby.pl --
     6# A component of the Greenstone digital library software
     7# from the New Zealand Digital Library Project at the
     8# University of Waikato, New Zealand.
     9#
     10# Copyright (C) 1999 New Zealand Digital Library Project
     11#
     12# This program is free software; you can redistribute it and/or modify
     13# it under the terms of the GNU General Public License as published by
     14# the Free Software Foundation; either version 2 of the License, or
     15# (at your option) any later version.
     16#
     17# This program is distributed in the hope that it will be useful,
     18# but WITHOUT ANY WARRANTY; without even the implied warranty of
     19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     20# GNU General Public License for more details.
     21#
     22# You should have received a copy of the GNU General Public License
     23# along with this program; if not, write to the Free Software
     24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     25#
     26###########################################################################
    427
    5 java "-Dderby.system.home=$DERBYDB_HOME" \
    6    -classpath $derbyjar_dir/derby.jar:$derbyjar_dir/derbynet.jar:$derbyjar_dir/derbytools.jar:$derbyjar_dir/derbyclient.jar \
    7    org.apache.derby.drda.NetworkServerControl start
     28BEGIN {
     29    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
     30    die "PHAROSIS_HOME not set\n" unless defined $ENV{'PHAROSIS_HOME'};
     31    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
     32}
    833
     34use strict;
     35
     36use util;
     37
     38sub main
     39{
     40
     41    my $jar_dir = &util::filename_cat($ENV{'PHAROSIS_HOME'},"WEB-INF","lib");
     42    my $derby_jar = &util::filename_cat($jar_dir,"derbynet.jar");
     43
     44    my $derbydb_home = $ENV{'DERBYDB_HOME'};
     45
     46    my $java_cmd = "java \"-Dderby.system.home=$derbydb_home\" ";
     47    $java_cmd .= "-classpath \"$derby_jar\" ";
     48    $java_cmd .= "org.apache.derby.drda.NetworkServerControl start";
     49
     50    my $status=system("$java_cmd &");
     51    if ($status != 0) {
     52    print STDERR "Error: failed to run $java_cmd\n";
     53    print STDERR "$!\n";
     54    exit 1;
     55    }
     56   
     57    my $log_file = &util::filename_cat($derbydb_home,"derby.log");
     58
     59    print "\n";
     60    print "*****\n";
     61    print "* Started Derby-DB server for databases at:\n";
     62    print "*  $derbydb_home\n";
     63    print "* Server running in background. Logging to:\n";
     64    print "*  $log_file\n";
     65    print "*****\n";
     66    print "\n";
     67
     68}
     69
     70main();
     71
Note: See TracChangeset for help on using the changeset viewer.