#! /tools/bin/perl

require '/usr/www/push/common20.pl';
require '/usr/www/push/php/scripts/auth.pl';

my $server = "stagedal2";
my $www_machine=shift;
my $webdir="/usr/local/webdev";
my $sourcedir="/usr/www/push/temp/src/apache_1.3.12/conf/epinions.conf";
##################################################
my $ssh="/tools/bin/ssh";

&auth();
&unlock_server();


&stop_start_lucene(stop);
sleep 2;
&stop_start_lucene(start);

sub stop_start_lucene
{
my $command=shift;
if ($command eq "stop"){
	$cmd="$ssh bd\@$server \" cd /usr/home/bd/disk/${www_machine}/bin/; ./httpd.sh stop \" ";
	print "$cmd\n";
	&ssh_pipe($cmd);
} elsif ($command eq "start") {
	$cmd="$ssh bd\@$server \"cd /usr/home/bd/disk/${www_machine}/bin/; ./httpd.sh start \" ";
	print "$cmd\n";
	&ssh_pipe($cmd);
} # End of if
} # End of stop_start_webdev

sub unlock_server
{
    $cmd="$ssh root\@$server \" /root/unlock; \" ";
    print "$cmd\n";
    &ssh_pipe($cmd);
}
