Commit 6ff47dd1 authored by Christoph Berg's avatar Christoph Berg

pg_createcluster, pg_dropcluster: When an auto-started cluster is created/...

pg_createcluster, pg_dropcluster: When an auto-started cluster is created/ dropped by root, notify systemd to update the dependencies of postgresql.service.wants.
parent ba1fb91c
postgresql-common (170) UNRELEASED; urgency=medium
* pg_createcluster, pg_dropcluster: When an auto-started cluster is created/
dropped by root, notify systemd to update the dependencies of
postgresql.service.wants.
* t/025_logging.t: Improve syslog detection in the test environment.
* pg_upgradecluster, t/030_errors.t: Unbreak after we changed the old=new
error message.
......
......@@ -4,7 +4,7 @@
# the postgresql-common infrastructure.
#
# (C) 2005-2013 Martin Pitt <mpitt@debian.org>
# (C) 2012-2014 Christoph Berg <myon@debian.org>
# (C) 2012-2015 Christoph Berg <myon@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -579,6 +579,11 @@ foreach my $guc (@pgoptions) {
PgCommon::set_conf_value $version, $cluster, 'postgresql.conf', $guc->[0], $guc->[1];
}
# notify systemd about the new cluster
if ($startconf eq 'auto' and -d '/var/run/systemd/system' and $euid == 0) {
system 'systemctl daemon-reload';
}
# start it if requested
if ($start) {
system 'pg_ctlcluster', $version, $cluster, 'start';
......
......@@ -4,6 +4,7 @@
# process attached.
#
# (C) 2005-2009 Martin Pitt <mpitt@debian.org>
# (C) 2015 Christoph Berg <myon@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -38,6 +39,7 @@ error 'invalid cluster name' unless defined $cluster;
my %info;
my $c; # configuration directory
my $startconf;
if (cluster_exists $version, $cluster) {
%info = cluster_info ($version, $cluster);
......@@ -55,6 +57,7 @@ if (cluster_exists $version, $cluster) {
}
}
$c = $info{'configdir'};
$startconf = $info{'start'};
} else {
$c = "/etc/postgresql/$version/$cluster";
......@@ -89,6 +92,12 @@ unlink "/var/log/postgresql/postgresql-$version-$cluster.log";
foreach my $f (</var/log/postgresql/postgresql-$version-$cluster.log.[1-9]*>) {
unlink ($f =~ /(.*)/); # untaint
}
# notify systemd when an autostarted cluster went away
if ($startconf eq 'auto' and -d '/var/run/systemd/system' and $> == 0) {
system 'systemctl daemon-reload';
}
exit 0;
__END__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment