Index: gs3-extensions/pharos/trunk/bin/script/pharos-start-derby.pl
===================================================================
--- gs3-extensions/pharos/trunk/bin/script/pharos-start-derby.pl	(revision 21275)
+++ gs3-extensions/pharos/trunk/bin/script/pharos-start-derby.pl	(revision 21275)
@@ -0,0 +1,71 @@
+#!/usr/bin/perl -w
+
+###########################################################################
+#
+# pharos-start-derby.pl --
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+BEGIN {
+    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
+    die "PHAROSIS_HOME not set\n" unless defined $ENV{'PHAROSIS_HOME'};
+    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
+}
+
+use strict;
+
+use util;
+
+sub main
+{
+
+    my $jar_dir = &util::filename_cat($ENV{'PHAROSIS_HOME'},"WEB-INF","lib");
+    my $derby_jar = &util::filename_cat($jar_dir,"derbynet.jar");
+
+    my $derbydb_home = $ENV{'DERBYDB_HOME'};
+
+    my $java_cmd = "java \"-Dderby.system.home=$derbydb_home\" ";
+    $java_cmd .= "-classpath \"$derby_jar\" ";
+    $java_cmd .= "org.apache.derby.drda.NetworkServerControl start";
+
+    my $status=system("$java_cmd &");
+    if ($status != 0) {
+	print STDERR "Error: failed to run $java_cmd\n";
+	print STDERR "$!\n";
+	exit 1;
+    }
+    
+    my $log_file = &util::filename_cat($derbydb_home,"derby.log");
+
+    print "\n";
+    print "*****\n";
+    print "* Started Derby-DB server for databases at:\n";
+    print "*  $derbydb_home\n";
+    print "* Server running in background. Logging to:\n";
+    print "*  $log_file\n";
+    print "*****\n";
+    print "\n";
+
+}
+
+main();
+
Index: gs3-extensions/pharos/trunk/bin/script/pharos-stop-derby.pl
===================================================================
--- gs3-extensions/pharos/trunk/bin/script/pharos-stop-derby.pl	(revision 21275)
+++ gs3-extensions/pharos/trunk/bin/script/pharos-stop-derby.pl	(revision 21275)
@@ -0,0 +1,63 @@
+#!/usr/bin/perl -w
+
+###########################################################################
+#
+# pharos-stop-derby.pl --
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the 
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+BEGIN {
+    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
+    die "PHAROSIS_HOME not set\n" unless defined $ENV{'PHAROSIS_HOME'};
+    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
+}
+
+use strict;
+
+use util;
+
+sub main
+{
+
+    my $jar_dir = &util::filename_cat($ENV{'PHAROSIS_HOME'},"WEB-INF","lib");
+    my $derby_jar = &util::filename_cat($jar_dir,"derbynet.jar");
+
+    my $derbydb_home = $ENV{'DERBYDB_HOME'};
+
+    my $java_cmd = "java \"-Dderby.system.home=$derbydb_home\" ";
+    $java_cmd .= "-classpath \"$derby_jar\" ";
+    $java_cmd .= "org.apache.derby.drda.NetworkServerControl shutdown";
+
+    my $status=system("$java_cmd &");
+    if ($status != 0) {
+	print STDERR "Error: failed to run $java_cmd\n";
+	print STDERR "$!\n";
+	exit 1;
+    }
+    
+
+}
+
+main();
+
+
+
