#! /tools/bin/perl

require '/usr/www/push/common20.pl';

my $dal_machine=shift;
my $daldir="/usr/home/bd/dal/bin";
##################################################
my $ssh="/tools/bin/ssh";

my $command="$ssh root\@$dal_machine \"/root/unlock \" ";
&ssh_pipe($command);
&stop_start_dal(stop);
&stop_start_dal(start);

sub stop_start_dal
{
my $command=shift;
$cmd="$ssh root\@$dal_machine \"/root/unlock \" ";
print "$cmd\n";
&ssh_pipe($cmd);
if ($command eq "stop"){
	$cmd="$ssh bd\@$dal_machine \"cd $daldir; ./dal_serverctl stop \" ";
	print "$cmd\n";
	&ssh_pipe($cmd);
} elsif ($command eq "start") {
	$cmd="$ssh bd\@$dal_machine \"cd $daldir; ./dal_serverctl start \" ";
	print "$cmd\n";
	&ssh_pipe($cmd);
	&ssh_pipe($cmd);
	&ssh_pipe($cmd);
} # End of if
} # End of stop_start_daldir
