Accepting request 1153509 from home:emilianolangella
Systemd unit files installed during the %install phase and other adjustments. OBS-URL: https://build.opensuse.org/request/show/1153509 OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/pgbadger?expand=0&rev=7
This commit is contained in:
parent
27da9c69f9
commit
b03df37ae5
27
README.SUSE
27
README.SUSE
@ -1,6 +1,6 @@
|
||||
Dear customer,
|
||||
|
||||
we provide two examples in this directory, which might help you
|
||||
We provide a cron job and a systemd timer and service, which might help you
|
||||
implementing an automatism for pgbadger on your local systems.
|
||||
|
||||
Security considerations:
|
||||
@ -83,23 +83,23 @@ Now it's time to work on the automation.
|
||||
|
||||
= Using a cron job
|
||||
|
||||
For historical reasons, we provide a small cron script in the following
|
||||
folder, that can be adjusted to your needs:
|
||||
/usr/share/doc/packages/pgbadger/example/pgbadger-cron.sh
|
||||
For historical reasons, we provide a small cron script for older distrubutions
|
||||
in the following
|
||||
folder, that you can adjust to your needs:
|
||||
|
||||
/etc/cron.d/
|
||||
|
||||
Just place the file into the /etc/cron.d/ directory and adjust it to your needs:
|
||||
cp -v /usr/share/doc/packages/pgbadger/example/pgbadger-cron.sh /etc/cron.d/pgbadger
|
||||
|
||||
= Using systemd timer
|
||||
|
||||
This is the recommended way.
|
||||
|
||||
Copy the needed files to your /etc/systemd/system directory:
|
||||
Please adjust the following systemd timer and unit (see comments inline) to
|
||||
your needs:
|
||||
|
||||
cp -v /usr/share/doc/packages/pgbadger/example/pgbadger.timer /etc/systemd/system/
|
||||
cp -v /usr/share/doc/packages/pgbadger/example/pgbadger.service /etc/systemd/system/
|
||||
systemctl edit pgbadger.timer
|
||||
systemctl edit pgbadger.service
|
||||
|
||||
Once done, please adjust the files (see comments inline) to your needs.
|
||||
After that, please enable the systemd timer with the following two
|
||||
commands:
|
||||
|
||||
@ -107,13 +107,6 @@ commands:
|
||||
systemctl enable pgbadger.timer
|
||||
|
||||
|
||||
|
||||
----
|
||||
And remember to have a lot of fun!
|
||||
Your SUSE Team.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
addFilter("missing-dependency-to-crontabs")
|
@ -36,10 +36,9 @@ Url: https://pgbadger.darold.net/
|
||||
Group: System/Monitoring
|
||||
Source0: https://github.com/darold/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Source1: %{name}-cron
|
||||
Source2: %{name}-rpmlintrc
|
||||
Source3: %{name}.timer
|
||||
Source4: %{name}.service
|
||||
Source5: README.SUSE
|
||||
Source2: %{name}.timer
|
||||
Source3: %{name}.service
|
||||
Source4: README.SUSE
|
||||
BuildRequires: cron
|
||||
BuildRequires: perl
|
||||
BuildRequires: perl(Getopt::Long)
|
||||
@ -68,9 +67,12 @@ Requires: perl(Encode)
|
||||
Requires: perl(Text::Wrap)
|
||||
Requires: perl(Time::Local)
|
||||
Requires: perl = %{perl_version}
|
||||
%{?systemd_ordering}
|
||||
|
||||
%if %{with cron}
|
||||
Recommends: cron
|
||||
%endif
|
||||
|
||||
# handle package rename at 2023-11-27:
|
||||
Obsoletes: PgBadger < %{version}
|
||||
Provides: PgBadger = %{version}-%{release}
|
||||
@ -111,34 +113,45 @@ make test
|
||||
%install
|
||||
%perl_make_install
|
||||
%perl_process_packlist
|
||||
rmdir %{buildroot}%{perl_vendorarch} || :
|
||||
# prepare docdir and install examples and documentation files
|
||||
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}/examples/
|
||||
rmdir %{buildroot}%{perl_vendorarch} || :
|
||||
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
|
||||
mkdir -p %{buildroot}%{_unitdir}
|
||||
mv tools %{buildroot}%{_defaultdocdir}/%{name}/
|
||||
mv ChangeLog README* %{buildroot}%{_defaultdocdir}/%{name}/
|
||||
%if %{with cron}
|
||||
# keep the old behavior for now and install the cron job example into the cron directory:
|
||||
# keep the old behavior for now and install the cron job into the cron directory:
|
||||
install -Dm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/cron.d/%{name}
|
||||
%else
|
||||
install -m 0644 %{SOURCE1} %{buildroot}%{_defaultdocdir}/%{name}/examples/pgbadger-cron.sh
|
||||
%endif
|
||||
# install systemd-timer examples into the documentation directory: leave it to our
|
||||
# customers to decide, if and how they want to use them
|
||||
install -m 0644 %{SOURCE3} %{buildroot}%{_defaultdocdir}/%{name}/examples/
|
||||
install -m 0644 %{SOURCE4} %{buildroot}%{_defaultdocdir}/%{name}/examples/
|
||||
install -m 0644 %{SOURCE5} %{buildroot}%{_defaultdocdir}/%{name}/
|
||||
# install the systemd timer and service in /usr/lib/systemd/system:
|
||||
install -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}
|
||||
install -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}
|
||||
# install the README.SUSE in the documentation dir:
|
||||
install -m 0644 %{SOURCE4} %{buildroot}%{_defaultdocdir}/%{name}/
|
||||
|
||||
%perl_gen_filelist
|
||||
|
||||
%pre
|
||||
%service_add_pre pgbadger.timer pgbadger.service
|
||||
|
||||
%post
|
||||
%service_add_post pgbadger.timer pgbadger.service
|
||||
|
||||
%preun
|
||||
%service_del_preun pgbadger.timer pgbadger.service
|
||||
|
||||
%postun
|
||||
%service_del_postun pgbadger.timer pgbadger.service
|
||||
|
||||
%files -f %{name}.files
|
||||
%license LICENSE
|
||||
%defattr(-, root, root, -)
|
||||
%dir %{_defaultdocdir}/%{name}
|
||||
%dir %{_defaultdocdir}/%{name}/tools
|
||||
%dir %{_defaultdocdir}/%{name}/examples
|
||||
%{_defaultdocdir}/%{name}/*
|
||||
%{_bindir}/pgbadger
|
||||
%{_mandir}/man1/pgbadger.1*
|
||||
%{_unitdir}/%{name}.timer
|
||||
%{_unitdir}/%{name}.service
|
||||
%if %{with cron}
|
||||
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
|
||||
%endif
|
||||
|
Loading…
Reference in New Issue
Block a user