Ship systemd files

This commit is contained in:
Vitezslav Crhonek 2011-08-24 17:13:58 +02:00
parent 8975cb95d8
commit e180dcc784
3 changed files with 70 additions and 1 deletions

36
mrtg.service Normal file
View File

@ -0,0 +1,36 @@
# To customize, copy this file to /etc/systemd/system and edit there
#
# This unit facilitates starting of MRTG. There are 2 options of
# how to run MRTG:
# - as a daemon (preferred); in this case please put
# RunAsDaemon: yes in mrtg.conf (or use --daemon switch)
# - periodically - please see and enable mrtg.timer
# Periodic settings need Type=oneshot set here
#
# Other recommended settings in mrtg.cfg for daemon mode:
# NoDetach: yes
# If you set this, change below Type=simple
#
# Please disable /etc/crond.d/mrtg job when using this unit!
#
# do not enable both mrtg-as-a-daemon and timer at the same time
[Unit]
Description=Multi-router Traffic Grapher
After=syslog.target
[Service]
Environment=LANG=C
ExecStart=/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
# Type= settings cheatsheet:
# - RunAsDaemon: yes; NoDetach: yes :
#Type=simple
# - RunAsDaemon: yes; NoDetach: no :
#Type=forking
# - RunAsDaemon: no; (periodic invocation) :
#Type=oneshot
Type=simple
StandardOutput=syslog
[Install]
WantedBy=multi-user.target

View File

@ -6,7 +6,7 @@
Summary: Multi Router Traffic Grapher
Name: mrtg
Version: 2.17.2
Release: 2%{?dist}
Release: 3%{?dist}
URL: http://oss.oetiker.ch/mrtg/
Source0: http://oss.oetiker.ch/mrtg/pub/mrtg-%{version}.tar.gz
Source1: http://oss.oetiker.ch/mrtg/pub/mrtg-%{version}.tar.gz.md5
@ -16,6 +16,8 @@ Source4: mrtg.crond.in
Source5: mrtg-httpd.conf
Source6: filter-provides-mrtg.sh
Source7: mrtg.tmpfiles
Source8: mrtg.service
Source9: mrtg.timer
Patch0: mrtg-2.15.0-lib64.patch
License: GPLv2+
Group: Applications/Internet
@ -80,6 +82,11 @@ install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/mrtg.conf
install -p -D -m 644 %{SOURCE7} $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/mrtg.conf
%endif
# install systemd files
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
install -p -m 644 %{SOURCE8} $RPM_BUILD_ROOT/lib/systemd/system/mrtg.service
install -p -m 644 %{SOURCE9} $RPM_BUILD_ROOT/lib/systemd/system/mrtg.timer
# Add mrtg-traffic-sum here when upstream decides to install it
for i in mrtg cfgmaker indexmaker mrtg-traffic-sum; do
sed -i 's;@@lib@@;%{_lib};g' "$RPM_BUILD_ROOT"%{_bindir}/"$i"
@ -122,8 +129,14 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/tmpfiles.d/mrtg.conf
%endif
%ghost /var/lock/mrtg
/lib/systemd/system/mrtg.service
/lib/systemd/system/mrtg.timer
%changelog
* Wed Aug 24 2011 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.17.2-3
- Ship systemd files
Resolves: #696147
* Thu Mar 24 2011 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.17.2-2
- Use %%ghost for /var/lock/mrtg
Resolves: #656629

20
mrtg.timer Normal file
View File

@ -0,0 +1,20 @@
# To customize, copy this file to /etc/systemd/system and edit there
#
# You can use this unit to periodically run mrtg.service.
# Only enable if you do not want to run mrtg as a daemon.
# Starting mrtg.timer while mrtg.service is running as a daemon has no point.
#
# Please disable /etc/crond.d/mrtg job when using this unit!
#
# Default is to run mrtg.service every 5 minutes, starting
# 1 minute after system boot.
[Unit]
Description=periodic invocation of MRTG
[Timer]
OnBootSec=1m
OnUnitActiveSec=5m
[Install]
WantedBy=multi-user.target