Bug 617320 - Providing native systemd file for upcoming F14 Feature Systemd
Providing native systemd file for upcoming F14 Feature Systemd
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: at (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Marcela Mašláňová
Fedora Extras Quality Assurance
: Reopened
: 656869 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-22 15:01 EDT by Jóhann B. Guðmundsson
Modified: 2010-12-07 08:42 EST (History)
6 users (show)

See Also:
Fixed In Version: at-3.1.12-7.fc15
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-12-07 08:42:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description Jóhann B. Guðmundsson 2010-07-22 15:01:07 EDT
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 07:03:42 EDT
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 07:26:02 EDT
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 08:44:58 EDT
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 09:50:32 EDT
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 09:50:41 EDT
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 08:08:14 EST
*** Bug 656869 has been marked as a duplicate of this bug. ***
Comment 7 Michał Piotrowski 2010-11-24 14:53:35 EST
+1 for Lennart's version https://bugzilla.redhat.com/show_bug.cgi?id=617320#c4
Comment 8 Lennart Poettering 2010-11-24 16:54:50 EST
(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 10:49:13 EST
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 15:34:20 EST
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 06:38:12 EST
(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 07:08:55 EST
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 07:21:57 EST
"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 08:30:36 EST
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 08:42:04 EST
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.