1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00
freebsd-ports/databases/pgpool-II-30/files/pgpool_remote_start
Jun Kuriyama b036602676 - Upgrade to 2.3.2.2.
- Improve error handling of recovery script.

Feature safe:	yes
2010-02-22 11:20:13 +00:00

27 lines
576 B
Perl

#!/usr/bin/perl
#
# $FreeBSD$
use strict;
use warnings;
my ($host, $dir) = @ARGV;
my $logger = "logger -t pgpool -p local0.info";
my $pgctl = "/usr/local/bin/pg_ctl -D $dir";
my ($fh, $log);
if (not open($fh, "ssh pgsql\@$host $pgctl -t 5 -w -s -m fast start 2>&1 |")) {
die "cannot open ssh: $!";
}
if (not open($log, "| $logger")) {
die "cannot open logger: $!";
}
while (<$fh>) {
print $log $_;
}
close($fh) or die "close(ssh) failed: $!";
close($log) or die "close(logger): $!";
system("ssh pgsql\@$host $pgctl status 2>&1") == 0 or die "pg_ctl status failed";