StartServer.pm (BackupPC-4.3.2) | : | StartServer.pm (BackupPC-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
# | # | |||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
# | # | |||
# Version 4.3.2, released 17 Feb 2020. | # Version 4.4.0, released 20 Jun 2020. | |||
# | # | |||
# See http://backuppc.sourceforge.net. | # See http://backuppc.sourceforge.net. | |||
# | # | |||
#======================================================================== | #======================================================================== | |||
package BackupPC::CGI::StartServer; | package BackupPC::CGI::StartServer; | |||
use strict; | use strict; | |||
use BackupPC::CGI::Lib qw(:all); | use BackupPC::CGI::Lib qw(:all); | |||
sub action | sub action | |||
{ | { | |||
if ( -f $Conf{ServerInitdPath} | if ( -f $Conf{ServerInitdPath} && $bpc->{Conf}{ServerInitdStartCmd} ne "" && | |||
&& $bpc->{Conf}{ServerInitdStartCmd} ne "" | !$bpc->ServerOK() ) { | |||
&& !$bpc->ServerOK() ) { | ||||
my $args = { | my $args = { | |||
serverInitdPath => $bpc->{Conf}{ServerInitdPath}, | serverInitdPath => $bpc->{Conf}{ServerInitdPath}, | |||
sshPath => $bpc->{Conf}{SshPath}, | sshPath => $bpc->{Conf}{SshPath}, | |||
serverHost => $bpc->{Conf}{ServerHost}, | serverHost => $bpc->{Conf}{ServerHost}, | |||
}; | }; | |||
my $serverInitdStartCmd = $bpc->cmdVarSubstitute($bpc->{Conf}{ServerInit dStartCmd}, $args); | my $serverInitdStartCmd = $bpc->cmdVarSubstitute($bpc->{Conf}{ServerInit dStartCmd}, $args); | |||
$bpc->cmdSystemOrEval($serverInitdStartCmd, undef, $args); | $bpc->cmdSystemOrEval($serverInitdStartCmd, undef, $args); | |||
for ( my $i = 0; $i < 10; $i++ ) { | for ( my $i = 0 ; $i < 10 ; $i++ ) { | |||
last unless ( $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPor t}) ); | last unless ( $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPor t}) ); | |||
sleep(1); | sleep(1); | |||
} | } | |||
$bpc->ServerDisconnect(); | $bpc->ServerDisconnect(); | |||
} | } | |||
print $Cgi->redirect($MyURL); | print $Cgi->redirect($MyURL); | |||
} | } | |||
1; | 1; | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 4 lines changed or added |