(55 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
= Systemd migration and packaging = | = Systemd migration and packaging = | ||
Systemd has excellent man pages for all the relevant migration options as well as [[Packaging:Systemd]] so see man: | |||
systemd.special | |||
systemd.service | |||
systemd.socket | |||
systemd.target | |||
systemd.timer | |||
systemd.time | |||
systemd.unit | |||
Line 33: | Line 39: | ||
drbd | drbd | ||
ebtables | ebtables | ||
firehol | firehol | ||
fts-server | fts-server | ||
Line 162: | Line 167: | ||
|amavisd-new-snmp||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | |amavisd-new-snmp||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | ||
|- | |- | ||
|bdii||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result| | |bdii||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|inprogress|Johannbg}}||No||Nobody|| | ||
|- | |- | ||
|bitten-slave||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | |bitten-slave||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | ||
Line 203: | Line 208: | ||
|- | |- | ||
|ebtables||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | |ebtables||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | ||
|- | |- | ||
|firehol||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | |firehol||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | ||
Line 238: | Line 241: | ||
|iprutils||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | |iprutils||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | ||
|- | |- | ||
|koji-builder||[https://bugzilla.redhat.com/show_bug.cgi?id= | |koji-builder||[https://bugzilla.redhat.com/show_bug.cgi?id=995753 995753]||{{result|fail|Nobody}}||No||Nobody|| | ||
|- | |- | ||
|koji-utils||[https://bugzilla.redhat.com/show_bug.cgi?id= | |koji-utils||[https://bugzilla.redhat.com/show_bug.cgi?id=995753 995753]||{{result|fail|Nobody}}||No||Nobody|| | ||
|- | |- | ||
|koji-vm||[https://bugzilla.redhat.com/show_bug.cgi?id= | |koji-vm||[https://bugzilla.redhat.com/show_bug.cgi?id=995753 995753]||{{result|fail|Nobody}}||No||Nobody|| | ||
|- | |- | ||
|ldirectord||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | |ldirectord||[https://bugzilla.redhat.com/show_bug.cgi?id=N/A #N/A]||{{result|fail|Nobody}}||No||Nobody|| | ||
Line 461: | Line 464: | ||
|- | |- | ||
|} | |} | ||
=== Spec file changes === | |||
<pre> | |||
[...] | |||
Source1: ackme.service | |||
BuildRequires: systemd | |||
Requires(post): systemd | |||
Requires(preun): systemd | |||
Requires(postun): systemd | |||
[...] | |||
%install | |||
mkdir -p %{buildroot}%{_unitdir} | |||
%{__install} -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir} | |||
%post | |||
%systemd_post ackme.service | |||
%preun | |||
%systemd_preun ackme.service | |||
%postun | |||
%systemd_postun_with_restart ackme.service | |||
%files | |||
%{_unitdir}/ackme.service | |||
[...] | |||
</pre> | |||
{{admon/note|| Remember some services do not support being restarted (e.g. D-Bus and various storage daemons). If the service you are migrating should not be restarted upon upgrade, then use the following %post scriptlet instead of the one shown above:}} | |||
<pre> | |||
%postun | |||
%systemd_postun | |||
</pre> | |||
=== Various unit samples === | |||
Since we have around 600 - 700 units already in the distribution it's best to look into /lib/systemd/system for existing samples for various type units rather then trying to list them all here. | |||
== Cron job to timer migration == | == Cron job to timer migration == | ||
=== When to migrate === | === When to migrate === | ||
If a package ships cron job as well as initscript or native systemd units it's applicable to migration to native systemd timer unit since it already depends on systemd. | |||
=== Setting up the migration environment for systemd timers. === | === Setting up the migration environment for systemd timers. === | ||
Line 612: | Line 657: | ||
|} | |} | ||
=== Timer unit samples === | Add the timer unit to git | ||
<pre> | |||
git add ackme-job.service | |||
git add ackme-job.timer | |||
</pre> | |||
Commit the change and create a patch. | |||
<pre> | |||
git commit -a -m "Migrating cron job to native systemd units" | |||
git format-patch -s -n master..systemd-timers | |||
</pre> | |||
Push the patch or file a bug in [https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora Fedora] and add it to the [https://bugzilla.redhat.com/show_bug.cgi?id=991679 Timer Migration Tracking Bug] by setting 991679 as an blocker in that report. | |||
=== Unit migration/Creation === | |||
Manual activation of timer units | |||
<pre> | |||
systemctl enable ackme.timer | |||
</pre> | |||
Starting the timer unit | |||
<pre> | |||
systemctl start ackme.timer | |||
</pre> | |||
Enablement of timer units by default is handled by[[Features/PackagePresets | presets]] | |||
=== Spec file changes === | |||
<pre> | |||
[...] | |||
Source1: ackme.service | |||
Source2: ackme.timer | |||
BuildRequires: systemd | |||
Requires(post): systemd | |||
Requires(preun): systemd | |||
Requires(postun): systemd | |||
[...] | |||
%install | |||
mkdir -p %{buildroot}%{_unitdir} | |||
%{__install} -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir} | |||
%{__install} -p -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir} | |||
%post | |||
%systemd_post | |||
%preun | |||
%systemd_preun | |||
%postun | |||
%systemd_postun | |||
%files | |||
%{_unitdir}/ackme.service | |||
%{_unitdir}/ackme.timer | |||
[...] | |||
</pre> | |||
=== Various Timer unit samples === | |||
==== Bound to another service ==== | |||
{{admon/note|| Should always be used when shipped with service/daemon units}} | |||
ackme.service: | ackme.service: | ||
<pre> | <pre> | ||
[Unit] | [Unit] | ||
Description=Ackme Service | Description=Ackme Sample Service | ||
Documentation=man:ackmed(1) | Documentation=man:ackmed(1) | ||
Line 630: | Line 744: | ||
<pre> | <pre> | ||
[Unit] | [Unit] | ||
Description=Ackme Sample Timer | Description=Ackme Sample Timer Trigger | ||
Documentation=man:ackmed(1) | Documentation=man:ackmed(1) | ||
BindTo=ackme.service | BindTo=ackme.service | ||
Line 652: | Line 766: | ||
ExecStart=/usr/bin/acme-job | ExecStart=/usr/bin/acme-job | ||
</pre> | </pre> | ||
==== After Boot Time Trigger ==== | |||
ackme-job.timer | |||
<pre> | |||
[Unit] | |||
Description=Ackme Sample Timer Trigger 5 Minutes After Boot | |||
Documentation=man:ackmed(1) | |||
BindTo=ackme.service | |||
[Timer] | |||
OnBootSec=5m | |||
[Install] | |||
WantedBy=timers.target | |||
</pre> | |||
ackme-job.service | |||
<pre> | |||
[Unit] | |||
Description=Daily Sample Ackme Job | |||
Documentation=man:ackmed(1) | |||
[Service] | |||
User=ackme | |||
ExecStart=/usr/bin/acme-job | |||
</pre> | |||
==== After Boot + Hourly Time Trigger ==== | |||
ackme-job.timer | |||
<pre> | |||
[Unit] | |||
Description=Ackme Sample Timer Trigger 5 Minutes After Boot And Hourly After That | |||
Documentation=man:ackmed(1) | |||
BindTo=ackme.service | |||
[Timer] | |||
OnBootSec=5m | |||
OnUnitActiveSec=1h | |||
[Install] | |||
WantedBy=timers.target | |||
</pre> | |||
ackme-job.service | |||
<pre> | |||
[Unit] | |||
Description=Daily Sample Ackme Job | |||
Documentation=man:ackmed(1) | |||
[Service] | |||
User=ackme | |||
ExecStart=/usr/bin/acme-job | |||
</pre> | |||
====Traditional Hourly ==== | |||
<pre> | |||
[Unit] | |||
Description=Ackme Sample Timer Trigger | |||
Documentation=man:ackmed(1) | |||
[Timer] | |||
OnCalendar=hourly | |||
[Install] | |||
WantedBy=timers.target | |||
</pre> | |||
ackme-job.service | |||
<pre> | |||
[Unit] | |||
Description=Daily Ackme Sample Job | |||
Documentation=man:ackmed(1) | |||
[Service] | |||
User=ackme | |||
ExecStart=/usr/bin/acme-job | |||
</pre> | |||
====Traditional Daily ==== | |||
<pre> | |||
[Unit] | |||
Description=Ackme Sample Timer Unit | |||
Documentation=man:ackmed(1) | |||
[Timer] | |||
OnCalendar=daily | |||
[Install] | |||
WantedBy=ackme.service | |||
</pre> | |||
ackme-job.service | |||
<pre> | |||
[Unit] | |||
Description=Daily ackme time trigger | |||
Documentation=man:ackmed(1) | |||
[Service] | |||
User=ackme | |||
ExecStart=/usr/bin/ackme-job | |||
</pre> | |||
==== Traditional Weekly ==== | |||
<pre> | |||
[Unit] | |||
Description=Ackme Sample Timer Unit | |||
Documentation=man:ackmed(1) | |||
[Timer] | |||
OnCalendar=weekly | |||
[Install] | |||
WantedBy=timers.target | |||
</pre> | |||
ackme-job.service | |||
<pre> | |||
[Unit] | |||
Description=Daily ackme time trigger | |||
Documentation=man:ackmed(1) | |||
[Service] | |||
User=ackme | |||
ExecStart=/usr/bin/ackme-job | |||
</pre> | |||
==== Traditional Monthly ==== | |||
<pre> | |||
[Unit] | |||
Description=Ackme Sample Timer Trigger | |||
Documentation=man:acmed(1) | |||
[Timer] | |||
OnCalendar=monthly | |||
[Install] | |||
WantedBy=timers.target | |||
</pre> | |||
ackme-job.service | |||
<pre> | |||
[Unit] | |||
Description=Monthly Ackme Sample Job | |||
Documentation=man:acmed(1) | |||
[Service] | |||
User=ackme | |||
ExecStart=/usr/bin/ackme-job | |||
</pre> | |||
= Systemd hacking for fun = | |||
== Idea Stick it 3000 == | |||
Create a minimal installer based on Kay's [http://people.freedesktop.org/~kay/installer/ Fedora minimal installer] which downloads and installs a fully bootable text mode UEFI-only btrfs system, that supports using btrfs [https://btrfs.wiki.kernel.org/index.php/Design_notes_on_Send/Receive send/receive]/[http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg17564.html sendshot]. | |||
UI design something similar to [https://fedorahosted.org/liveusb-creator/ liveusb creator] | |||
Would need to support both yum and apt-get |
Latest revision as of 14:39, 12 August 2013
Systemd migration and packaging
Systemd has excellent man pages for all the relevant migration options as well as Packaging:Systemd so see man:
systemd.special systemd.service systemd.socket systemd.target systemd.timer systemd.time systemd.unit
Sysv to systemd service migration
Setting up the migration environment for systemd services.
For sys V to systemd migration create a service.txt file with the following unmigrated ( 119 ) components in Fedora
amavisd-new bdii bitten bluez boa ceph cfengine cherokee clement conmux ctdb cyphesis dahdi-tools dhcp_probe dircproxy diskimage-builder dkim-milter dpm-dsi drbdlinks drbd ebtables firehol fts-server globus-gatekeeper globus-gridftp-server globus-rls-server globus-scheduler-event-generator gmediaserver gofer greylistd i8kutils ibmasm imagefactory iodine iprutils koji resource-agents ltsp lvm2 mimedefang perl-mogilefs-server mom monotone moodle mysql-proxy nagios ncid nessus-core netbsd-iscsi netcf netdisco netdump-server nightview noip nordugrid-arc nxtvepg oidentd openpts openscada openser openslp opentracker orbited ovirt-engine pathfinder pcp Perlbal pgbouncer plague pnp4nagios popfile powerman psad python-carbon qpid-cpp RabbIT ratbox-services redis rinputd ris-linux root roundup rubygem-openshift-origin-node sagator ser sigul sip-redirect sipwitch sks smstools snake spampd spawn-fcgi Spawning spectrum ssbd sslogger svxlink tabled tetrinetx thebridge tinyproxy tmda torque ttywatch ulogd vblade vhostmd vmpsd voms Vuurmuur xorg-x11-xfs xrootd xtide yum-cron yum-utils zarafa
Then git clone the packages from Fedora
while read line; do git clone git://pkgs.fedoraproject.org/$line; done < services.txt
Create a separated branch to work on
while read line; do cd $line; git checkout -b systemd-timers; cd - done < services.txt
Decide which component you are going to be migrating and add your name next to it on this list
Package name | Bug Number | Port Status | Ready for Proven Packager | Proven Packager | Note |
amavisd-new | #N/A | Nobody |
No | Nobody | |
amavisd-new-snmp | #N/A | Nobody |
No | Nobody | |
bdii | #N/A | No | Nobody | ||
bitten-slave | #N/A | Nobody |
No | Nobody | |
bluez-compat | #N/A | Nobody |
No | Nobody | |
boa | #N/A | Nobody |
No | Nobody | |
ceph | #N/A | Nobody |
No | Nobody | |
cfengine | #N/A | Nobody |
No | Nobody | |
cherokee | #N/A | Nobody |
No | Nobody | |
clement | #N/A | Nobody |
No | Nobody | |
cmirror | #N/A | Nobody |
No | Nobody | |
conmux | #N/A | Nobody |
No | Nobody | |
ctdb-tests | #N/A | Nobody |
No | Nobody | |
cyphesis | #N/A | Nobody |
No | Nobody | |
dahdi-tools | #N/A | Nobody |
No | Nobody | |
dhcp_probe | #N/A | Nobody |
No | Nobody | |
dircproxy | #N/A | Nobody |
No | Nobody | |
diskimage-builder | #N/A | Nobody |
No | Nobody | |
dkim-milter | #N/A | Nobody |
No | Nobody | |
dpm-dsi | #N/A | Nobody |
No | Nobody | |
drbdlinks | #N/A | Nobody |
No | Nobody | |
drbd-utils | #N/A | Nobody |
No | Nobody | |
ebtables | #N/A | Nobody |
No | Nobody | |
firehol | #N/A | Nobody |
No | Nobody | |
fts-server | #N/A | Nobody |
No | Nobody | |
globus-gatekeeper | #N/A | Nobody |
No | Nobody | |
globus-gridftp-server-progs | #N/A | Nobody |
No | Nobody | |
globus-rls-server | #N/A | Nobody |
No | Nobody | |
globus-scheduler-event-generator-progs | #N/A | Nobody |
No | Nobody | |
gmediaserver | #N/A | Nobody |
No | Nobody | |
gofer | #N/A | Nobody |
No | Nobody | |
greylistd | #N/A | Nobody |
No | Nobody | |
i8kutils | #N/A | Nobody |
No | Nobody | |
ibmasm | #N/A | Nobody |
No | Nobody | |
ifplugd | #N/A | Nobody |
No | Orphan | |
imagefactory | #N/A | Nobody |
No | Nobody | |
iodine-client | #N/A | Nobody |
No | Nobody | |
iodine-server | #N/A | Nobody |
No | Nobody | |
iprutils | #N/A | Nobody |
No | Nobody | |
koji-builder | 995753 | Nobody |
No | Nobody | |
koji-utils | 995753 | Nobody |
No | Nobody | |
koji-vm | 995753 | Nobody |
No | Nobody | |
ldirectord | #N/A | Nobody |
No | Nobody | |
ltsp-server | #N/A | Nobody |
No | Nobody | |
lvm2-cluster | #N/A | Nobody |
No | Nobody | |
mimedefang | #N/A | Nobody |
No | Nobody | |
mogilefsd | #N/A | Nobody |
No | Nobody | |
mogstored | #N/A | Nobody |
No | Nobody | |
mom | #N/A | Nobody |
No | Nobody | |
monotone-server | #N/A | Nobody |
No | Nobody | |
moodle | #N/A | Nobody |
No | Nobody | |
mysql-mmm-agent | #N/A | Nobody |
No | Nobody | ORPHAN |
mysql-mmm-monitor | #N/A | Nobody |
No | Nobody | ORPHAN |
mysql-proxy | #N/A | Nobody |
No | Nobody | |
nagios | #N/A | Nobody |
No | Nobody | |
ncid | #N/A | Nobody |
No | Nobody | |
ncid-client | #N/A | Nobody |
No | Nobody | |
ncid-samba | #N/A | Nobody |
No | Nobody | |
ncid-speak | #N/A | Nobody |
No | Nobody | |
nessus-server | #N/A | Nobody |
No | Nobody | |
netbsd-iscsi | #N/A | Nobody |
No | Nobody | |
netcf-libs | #N/A | Nobody |
No | Nobody | |
netdisco | #N/A | Nobody |
No | Nobody | |
netdump-server | #N/A | Nobody |
No | Nobody | |
nightview-server | #N/A | Nobody |
No | Nobody | |
noip | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-acix-cache | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-acix-index | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-arex | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-aris | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-cache-service | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-datadelivery-service | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-egiis | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-gridftpd | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-hed | #N/A | Nobody |
No | Nobody | |
nordugrid-arc-ldap-infosys | #N/A | Nobody |
No | Nobody | |
nxtvepg | #N/A | Nobody |
No | Nobody | |
oidentd | #N/A | Nobody |
No | Nobody | |
openpts | #N/A | Nobody |
No | Nobody | |
openscada | #N/A | Nobody |
No | Nobody | |
openser | #N/A | Nobody |
No | Nobody | |
openslp-server | #N/A | Nobody |
No | Nobody | |
opentracker-ipv4 | #N/A | Nobody |
No | Nobody | |
opentracker-ipv6 | #N/A | Nobody |
No | Nobody | |
orbited | #N/A | Nobody |
No | Nobody | |
ovirt-engine-notification-service | #N/A | Nobody |
No | Nobody | |
pathfinderd | #N/A | Nobody |
No | Nobody | |
pcp | #N/A | Nobody |
No | Nobody | |
Perlbal | #N/A | Nobody |
No | Nobody | |
pgbouncer | #N/A | Nobody |
No | Nobody | |
plague | #N/A | Nobody |
No | Nobody | |
plague-builder | #N/A | Nobody |
No | Nobody | |
pnp4nagios | #N/A | Nobody |
No | Nobody | |
popfile | #N/A | Nobody |
No | Nobody | |
powerman | #N/A | Nobody |
No | Nobody | |
preload | #N/A | Nobody |
No | Nobody | ORPHAN |
psad | #N/A | Nobody |
No | Nobody | |
python-carbon | #N/A | Nobody |
No | Nobody | |
qpid-cpp-server-ha | #N/A | Nobody |
No | Nobody | |
RabbIT | #N/A | Nobody |
No | Nobody | |
ratbox-services | #N/A | Nobody |
No | Nobody | |
redis | #N/A | Nobody |
No | Nobody | |
rinputd | #N/A | Nobody |
No | Nobody | |
ris-linux | #N/A | Nobody |
No | Nobody | |
root-proofd | #N/A | Nobody |
No | Nobody | |
root-rootd | #N/A | Nobody |
No | Nobody | |
roundup | #N/A | Nobody |
No | Nobody | |
rubygem-openshift-origin-node | #N/A | Nobody |
No | Nobody | |
sagator-core | #N/A | Nobody |
No | Nobody | |
ser | #N/A | Nobody |
No | Nobody | |
sigul | #N/A | Nobody |
No | Nobody | |
sip-redirect | #N/A | Nobody |
No | Nobody | |
sipwitch | #N/A | Nobody |
No | Nobody | |
sks | #N/A | Nobody |
No | Nobody | |
smstools | #N/A | Nobody |
No | Nobody | |
snake-server | #N/A | Nobody |
No | Nobody | |
spampd | #N/A | Nobody |
No | Nobody | |
spawn-fcgi | #N/A | Nobody |
No | Nobody | |
Spawning | #N/A | Nobody |
No | Nobody | |
spectrum | #N/A | Nobody |
No | Nobody | |
ssbd | #N/A | Nobody |
No | Nobody | |
sslogger-slogd | #N/A | Nobody |
No | Nobody | |
svxlink-server | #N/A | Nobody |
No | Nobody | |
tabled | #N/A | Nobody |
No | Nobody | |
tetrinetx | #N/A | Nobody |
No | Nobody | |
thebridge | #N/A | Nobody |
No | Nobody | |
tinyproxy | #N/A | Nobody |
No | Nobody | |
tmda-ofmipd | #N/A | Nobody |
No | Nobody | |
torque-mom | #N/A | Nobody |
No | Nobody | |
torque-scheduler | #N/A | Nobody |
No | Nobody | |
torque-server | #N/A | Nobody |
No | Nobody | |
ttywatch | #N/A | Nobody |
No | Nobody | |
ulogd | #N/A | Nobody |
No | Nobody | |
vblade | #N/A | Nobody |
No | Nobody | |
vhostmd | #N/A | Nobody |
No | Nobody | |
vmpsd | #N/A | Nobody |
No | Nobody | |
voms-server | #N/A | Nobody |
No | Nobody | |
Vuurmuur-daemon | #N/A | Nobody |
No | Nobody | |
xorg-x11-xfs | #N/A | Nobody |
No | Nobody | |
xrootd | #N/A | Nobody |
No | Nobody | |
xtide | #N/A | Nobody |
No | Nobody | |
yum-cron | #N/A | Nobody |
No | Nobody | |
yum-updateonboot | #N/A | Nobody |
No | Nobody | |
zarafa-dagent | #N/A | Nobody |
No | Nobody | |
zarafa-gateway | #N/A | Nobody |
No | Nobody | |
zarafa-ical | #N/A | Nobody |
No | Nobody | |
zarafa-monitor | #N/A | Nobody |
No | Nobody | |
zarafa-search | #N/A | Nobody |
No | Nobody | |
zarafa-server | #N/A | Nobody |
No | Nobody | |
zarafa-spooler | #N/A | Nobody |
No | Nobody |
Spec file changes
[...] Source1: ackme.service BuildRequires: systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd [...] %install mkdir -p %{buildroot}%{_unitdir} %{__install} -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir} %post %systemd_post ackme.service %preun %systemd_preun ackme.service %postun %systemd_postun_with_restart ackme.service %files %{_unitdir}/ackme.service [...]
%postun %systemd_postun
Various unit samples
Since we have around 600 - 700 units already in the distribution it's best to look into /lib/systemd/system for existing samples for various type units rather then trying to list them all here.
Cron job to timer migration
When to migrate
If a package ships cron job as well as initscript or native systemd units it's applicable to migration to native systemd timer unit since it already depends on systemd.
Setting up the migration environment for systemd timers.
For timer migration create a timers.txt file with the following content.
amavisd-new apt arm4 atop bcfg2 clement cyrus-imapd dbmail denyhosts dspam exim fetch-crl freeipa hylafax+ inn leafnode ltsp mailman mcelog mdadm mldonkey newscache nsd opendnssec openvas-scanner ovirt-engine ovirt-node polipo sagator sipwitch spamassassin squidGuard subscription-manager sysstat vdsm vnstat yum-cron
Then git clone the packages from Fedora
while read line do git clone git://pkgs.fedoraproject.org/$line; done < timers.txt
Create a separated branch to work on
while read line do cd $line; git checkout -b systemd-timers; cd - done < timers.txt
Decide which component you are going to be migrating and add your name next to it on this list
Package name | Bug Number | Port Status | Ready for Proven Packager | Proven Packager | Note |
amavisd-new | #N/A | Nobody |
No | Nobody | drop cron use tmpfile |
apt | #991684 | Yes | Nobody | ||
arm4 | #991696 | Yes | Nobody | ||
atop | #N/A | Nobody |
No | Nobody | Cron job restarts service could potentially be a feature |
bcfg2 | #N/A | Nobody |
No | Nobody | |
clement | #N/A | Nobody |
No | Nobody | |
cyrus-imapd | #N/A | Nobody |
No | Nobody | |
dbmail | #N/A | Nobody |
No | Nobody | |
denyhosts | #N/A | Nobody |
No | Nobody | |
dspam | #N/A | Nobody |
No | Nobody | |
exim | #N/A | Nobody |
No | Nobody | |
fetch-crl | #N/A | Nobody |
No | Nobody | |
freeipa-server | #N/A | Nobody |
No | Nobody | |
hylafax+ | #N/A | Nobody |
No | Nobody | |
inn | #N/A | Nobody |
No | Nobody | |
leafnode | #N/A | Nobody |
No | Nobody | |
ltsp-server | #N/A | Nobody |
No | Nobody | |
mailman | #N/A | Nobody |
No | Nobody | |
mcelog | #N/A | Nobody |
No | Nobody | |
mdadm | #N/A | Nobody |
No | Nobody | |
mldonkey-server | #N/A | Nobody |
No | Nobody | |
newscache | #N/A | Nobody |
No | Nobody | |
nsd | #N/A | Nobody |
No | Nobody | |
opendnssec | #N/A | Nobody |
No | Nobody | |
openvas-scanner | #N/A | Nobody |
No | Nobody | |
ovirt-engine | #N/A | Nobody |
No | Nobody | |
ovirt-node | #N/A | Nobody |
No | Nobody | |
polipo | #N/A | Nobody |
No | Nobody | |
sagator-core | #N/A | Nobody |
No | Nobody | |
sipwitch | #N/A | Nobody |
No | Nobody | |
spamassassin | #N/A | Nobody |
No | Nobody | |
squidGuard | #N/A | Nobody |
No | Nobody | |
subscription-manager | #N/A | Nobody |
No | Nobody | |
sysstat | #N/A | Nobody |
No | Nobody | |
vdsm-reg | #N/A | Nobody |
No | Nobody | |
vnstat | #N/A | Nobody |
No | Nobody | |
yum-cron | #N/A | Nobody |
No | Nobody |
Add the timer unit to git
git add ackme-job.service git add ackme-job.timer
Commit the change and create a patch.
git commit -a -m "Migrating cron job to native systemd units" git format-patch -s -n master..systemd-timers
Push the patch or file a bug in Fedora and add it to the Timer Migration Tracking Bug by setting 991679 as an blocker in that report.
Unit migration/Creation
Manual activation of timer units
systemctl enable ackme.timer
Starting the timer unit
systemctl start ackme.timer
Enablement of timer units by default is handled by presets
Spec file changes
[...] Source1: ackme.service Source2: ackme.timer BuildRequires: systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd [...] %install mkdir -p %{buildroot}%{_unitdir} %{__install} -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir} %{__install} -p -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir} %post %systemd_post %preun %systemd_preun %postun %systemd_postun %files %{_unitdir}/ackme.service %{_unitdir}/ackme.timer [...]
Various Timer unit samples
Bound to another service
ackme.service:
[Unit] Description=Ackme Sample Service Documentation=man:ackmed(1) [Service] ExecStart=/usr/bin/ackmed [Install] WantedBy=multi-user.target
ackme-job.timer
[Unit] Description=Ackme Sample Timer Trigger Documentation=man:ackmed(1) BindTo=ackme.service [Timer] OnCalendar=daily [Install] WantedBy=ackme.service
ackme-job.service
[Unit] Description=Daily ackme Job Documentation=man:ackmed(1) [Service] User=ackme ExecStart=/usr/bin/acme-job
After Boot Time Trigger
ackme-job.timer
[Unit] Description=Ackme Sample Timer Trigger 5 Minutes After Boot Documentation=man:ackmed(1) BindTo=ackme.service [Timer] OnBootSec=5m [Install] WantedBy=timers.target
ackme-job.service
[Unit] Description=Daily Sample Ackme Job Documentation=man:ackmed(1) [Service] User=ackme ExecStart=/usr/bin/acme-job
After Boot + Hourly Time Trigger
ackme-job.timer
[Unit] Description=Ackme Sample Timer Trigger 5 Minutes After Boot And Hourly After That Documentation=man:ackmed(1) BindTo=ackme.service [Timer] OnBootSec=5m OnUnitActiveSec=1h [Install] WantedBy=timers.target
ackme-job.service
[Unit] Description=Daily Sample Ackme Job Documentation=man:ackmed(1) [Service] User=ackme ExecStart=/usr/bin/acme-job
Traditional Hourly
[Unit] Description=Ackme Sample Timer Trigger Documentation=man:ackmed(1) [Timer] OnCalendar=hourly [Install] WantedBy=timers.target
ackme-job.service
[Unit] Description=Daily Ackme Sample Job Documentation=man:ackmed(1) [Service] User=ackme ExecStart=/usr/bin/acme-job
Traditional Daily
[Unit] Description=Ackme Sample Timer Unit Documentation=man:ackmed(1) [Timer] OnCalendar=daily [Install] WantedBy=ackme.service
ackme-job.service
[Unit] Description=Daily ackme time trigger Documentation=man:ackmed(1) [Service] User=ackme ExecStart=/usr/bin/ackme-job
Traditional Weekly
[Unit] Description=Ackme Sample Timer Unit Documentation=man:ackmed(1) [Timer] OnCalendar=weekly [Install] WantedBy=timers.target
ackme-job.service
[Unit] Description=Daily ackme time trigger Documentation=man:ackmed(1) [Service] User=ackme ExecStart=/usr/bin/ackme-job
Traditional Monthly
[Unit] Description=Ackme Sample Timer Trigger Documentation=man:acmed(1) [Timer] OnCalendar=monthly [Install] WantedBy=timers.target
ackme-job.service
[Unit] Description=Monthly Ackme Sample Job Documentation=man:acmed(1) [Service] User=ackme ExecStart=/usr/bin/ackme-job
Systemd hacking for fun
Idea Stick it 3000
Create a minimal installer based on Kay's Fedora minimal installer which downloads and installs a fully bootable text mode UEFI-only btrfs system, that supports using btrfs send/receive/sendshot.
UI design something similar to liveusb creator
Would need to support both yum and apt-get