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:
For SysVinit scripts exist Guidelines with example. I'm waiting for something short and comprehensible with functional example init script.
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?
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
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>
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
*** Bug 656869 has been marked as a duplicate of this bug. ***
+1 for Lennart's version https://bugzilla.redhat.com/show_bug.cgi?id=617320#c4
(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
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 ?
Quotation mark striping is different for ${OPTS} and $OPTS. Difference is described in man systemd.service, at the end of ExecStart= paragraph.
(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>
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.
"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
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
Calling systemctl --system daemon-reload and service atd restart is in my opinion weird, but it's working for me.