mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-24 04:33:24 +00:00
b036602676
- Improve error handling of recovery script. Feature safe: yes
27 lines
576 B
Perl
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";
|