-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 В Sun, 01 Mar 2015 07:45:02 +0100 Johannes Kastl <mail@ojkastl.de> пишет:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 01.03.2015 Andrei Borzenkov wrote:
В Sun, 1 Mar 2015 01:55:50 -0300 Cristian Rodríguez <crrodriguez@opensuse.org> пишет:
[advantages/disadvantages of type=notify over type=oneshot]
In this case, the services ordered After= your custom service will not start until it PID1 gets notifed that the startup of your service is complete.
Which is what I want to achieve. And what oneshot does, too, right?
No. For oneshot services systemd starts service and waits until it is finishes before continuing with any other service that depends on it. It is difference between starting long running background services and doing one time job.
This is oneshot service - systemd waits until it is *finished* before starting dependent services.
I'm confused.
What about? Behavior of oneshot is similar to simple; however, it is expected that the process has to exit before systemd starts follow-up units. What is confusing here?
I thought "TimeoutSec=0" (or 600 or ...) was exactly for this kind of long running commands?
TimeoutStartSec= in this case.
But it is disabled for oneshot services anyway.
More confused.
TimeoutStartSec= ... Defaults to TimeoutStartSec= from the manager configuration file, except when Type=oneshot is used, in which case the timeout is disabled by default.
For the record, or the next one as confused as I am, this worked (where foobar.service is my service of type oneshot):
- -----------------------
$systemctl cat display-manager.service # /usr/lib/systemd/system/display-manager.service [Unit] Description=X Display Manager Requires=var-run.mount After=ypbind.service gpm.service time-sync.target winbind.service acpid.service Wants=remote-fs.target dbus.socket systemd-user-sessions.service After=remote-fs.target dbus.socket systemd-user-sessions.service
[Service] Type=forking PIDFile=/var/run/displaymanager.pid ExecStart=/usr/lib/X11/display-manager start ExecStop=/usr/lib/X11/display-manager stop ExecReload=/usr/lib/X11/display-manager reload KillMode=process
[Install] WantedBy=graphical.target Alias=xdm.service
# /etc/systemd/system/display-manager.service.d/wait_for_foobar.conf [Unit] Requires=foobar.service After=remote-fs.target dbus.socket systemd-user-sessions.service foobar.service
$systemctl cat foobar.service [Unit] Description="foobar" ConditionFileIsExecutable=/path/to/script.sh After=basic.target
[Service] Type=oneshot ExecStart=/path/to/script.sh TimeoutSec=0 RemainAfterExit=yes
[Install] WantedBy=multi-user.target
Regards, Johannes - -- Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read. (Groucho Marx) -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/
iEYEARECAAYFAlTytWgACgkQzi3gQ/xETbI+4ACfa3NRRbIc+v4y/B+jAHnZ5moa pycAmwfrYoWiMDuDQGjHJALRckJI/aPh =GTT/ -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlTyvEgACgkQR6LMutpd94ypcACfezsAIZktXiBwy9ONxeAwYcHc TwcAn1AHThwozlbHqloml0DKe1Ar1yeR =GPFd -----END PGP SIGNATURE-----