Bug 617320 - Providing native systemd file for upcoming F14 Feature Systemd
Summary: Providing native systemd file for upcoming F14 Feature Systemd
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: at
Version: 14
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 656869 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-22 19:01 UTC by Jóhann B. Guðmundsson
Modified: 2010-12-07 13:42 UTC (History)
6 users (show)

Fixed In Version: at-3.1.12-7.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-07 13:42:04 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Native systemd file for at (138 bytes, text/plain)
2010-07-22 19:01 UTC, Jóhann B. Guðmundsson
no flags Details

Description Jóhann B. Guðmundsson 2010-07-22 19:01:07 UTC
Created attachment 433778 [details]
Native systemd file for at

Description of problem:

The attached file is a native systemd file for upcoming F14 Feature [1]

Please read [2] on how to installing systemd Service files.

1.http://fedoraproject.org/wiki/Features/systemd
2.https://fedoraproject.org/wiki/User:Johannbg/QA/Systemd/Daemon#Installing_Systemd_Service_Files

If you have any question dont hesitate to ask them on this bug report.

Thank you. 

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Marcela Mašláňová 2010-07-23 11:03:42 UTC
For SysVinit scripts exist Guidelines with example. I'm waiting for something short and comprehensible with functional example init script.

Comment 2 Marcela Mašláňová 2010-07-23 11:26:02 UTC
I have only two questions, because I didn't read whole fedora-devel thread about systemd.

1. Why atd -f? Daemons will be running in foreground? Why?
2. Did you notice that at daemon has sysconfig file, where are stored quite useful options? In case systemd won't read sysconfig files, where will be stored setting?

Comment 3 Bug Zapper 2010-07-30 12:44:58 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 4 Lennart Poettering 2010-08-10 13:50:32 UTC
Regarding your issue #1:

If daemons fork away then systemd would not know which is the main process of the daemon which makes it hard supervising it: i.e. restart it if it crashed, collect crash information and so on. By setting "-f" we make sure that at is started and the process systemd fork is the main process of at. 

Regarding issue 2#:

it is easy to add support for sysconfig files to the service file. Simply use the EnvironmentFile= directive to import the env vars and then use $OPTS to refer to them in the command line. The result would look something like this:

<snip>
[Unit]
Description=Execution Queue Daemon
After=syslog.target

[Service]
EnvironmentFile=/etc/sysconfig/atd
ExecStart=/usr/sbin/atd -f $OPTS

[Install]
WantedBy=multi-user.target
</snip>

Comment 5 Lennart Poettering 2010-08-11 13:50:41 UTC
BTW, it is not sufficient to just drop the .service files into
/lib/systemd/system. It is also necessary to enable it when upgrading from an
old sysv-only rpm. How to implement that in the spec file with minimal work is
documented in daemon(7):

http://0pointer.de/public/systemd-man/daemon.html#id2562029

Comment 6 Michał Piotrowski 2010-11-24 13:08:14 UTC
*** Bug 656869 has been marked as a duplicate of this bug. ***

Comment 7 Michał Piotrowski 2010-11-24 19:53:35 UTC
+1 for Lennart's version https://bugzilla.redhat.com/show_bug.cgi?id=617320#c4

Comment 8 Lennart Poettering 2010-11-24 21:54:50 UTC
(In reply to comment #1)
> For SysVinit scripts exist Guidelines with example. I'm waiting for something
> short and comprehensible with functional example init script.

BTW, we now have a (draft still) package guideline for systemd:

https://fedoraproject.org/wiki/Systemd_Packaging_Draft#Scriptlets

Comment 9 Jiri Popelka 2010-12-06 15:49:13 UTC
Marcelo, I'm not sure this is fixed.

(In reply to comment #2)
> I have only two questions, because I didn't read whole fedora-devel thread
> about systemd.
> 
> 1. Why atd -f? Daemons will be running in foreground? Why?

Why did you use '-n' instead of '-f' in 
ExecStart=/usr/sbin/atd -n $OPTS

I don't see '-n' option in atd(8).
Also the service doesn't start with it.
- ExecStart=/usr/sbin/atd -n $OPTS
+ ExecStart=/usr/sbin/atd -f $OPTS
fixes the problem.

> 2. Did you notice that at daemon has sysconfig file, where are stored quite
> useful options? In case systemd won't read sysconfig files, where will be
> stored setting?

When un-commenting the example
OPTS="-l 4 -b 120"
in /etc/sysconfig/atd
the service also refuses to start.
Removing the quotation marks
OPTS=-l 4 -b 120
fixes the problem.
But this is only a work-around.
I think it is systemd who should be stripping off the quotation marks.

Lennart, what do you think ?

Comment 10 Tomasz Torcz 2010-12-06 20:34:20 UTC
Quotation mark striping is different for ${OPTS} and $OPTS. Difference is described in man systemd.service, at the end of ExecStart= paragraph.

Comment 11 Jiri Popelka 2010-12-07 11:38:12 UTC
(In reply to comment #10)
> Quotation mark striping is different for ${OPTS} and $OPTS. Difference is
> described in man systemd.service, at the end of ExecStart= paragraph.

Well, I already tried ${OPTS} and it seemed to me that there's no difference.

systemctl show atd.service shows:

<snip>
LoadState=loaded
ActiveState=failed
SubState=failed
<snip>
ExecStart={ path=/usr/sbin/atd ; argv[]=/usr/sbin/atd -f ${OPTS} ; ignore=no ; start_time=[Tue, 07 Dec 2010 12:27:55 +0100] ; stop_time=[n/a] ; pid=908 ; code=(null) ; status=0/ }
Environment=OPTS="-l 4 -b 120"
<snip>

Comment 12 Jiri Popelka 2010-12-07 12:08:55 UTC
Whoops. Now it's ok with
ExecStart=/usr/sbin/atd -f $OPTS
OPTS="-l 4 -b 120"
I don't have any idea what was wrong but for now you can probably ignore my comments about the quotation marks.

Comment 13 Michał Piotrowski 2010-12-07 12:21:57 UTC
"I don't have any idea what was wrong but for now you can probably ignore my
comments about the quotation marks."

Have you reloaded systemd?

systemctl --system daemon-reload

If not, then OPTS=-l 4 -b 120 is still cached

Comment 14 Jiri Popelka 2010-12-07 13:30:36 UTC
Yes, I always reloaded it.
And always checked with 'systemctl show' which shows what's in $OPTS.
I have also created systemd service files for dhcpd/dhcpd6/dhcrelay.
I saw exactly the same behaviour trying to run them couple days ago
and now they work like a charm. strange

Comment 15 Marcela Mašláňová 2010-12-07 13:42:04 UTC
Calling systemctl --system daemon-reload and service atd restart is in my opinion weird, but it's working for me.


Note You need to log in before you can comment on or make changes to this bug.