[systemd-devel] FC16 - how to get ExecStop= to be executed at shutdown?
Josh Geisser
josh at gebaschtel.ch
Sun Dec 4 09:50:34 PST 2011
Hi Zbigniew
I added the "| logger" b/c i wanted additional proove that the scripts are actually executed, and it seems to work, the start-output is logged into syslog.
But not the ExecStop. I added some more logging and the stop command seems never to be executed.
Also, the VMs take time to shutdown, but Xfce just terminate upon shutdown, definitely does not wait until the VBox service is stopped.
It might be that systemd terminates the PIDs of the VMs directly, but it's currently not executing the ExecStop ... bet I'm missing something.
Cheers
Josh
-----Ursprüngliche Nachricht-----
Von: systemd-devel-bounces+josh=gebaschtel.ch at lists.freedesktop.org [mailto:systemd-devel-bounces+josh=gebaschtel.ch at lists.freedesktop.org] Im Auftrag von Zbigniew Jedrzejewski-Szmek
Gesendet: Sonntag, 4. Dezember 2011 18:28
An: systemd-devel at lists.freedesktop.org
Betreff: Re: [systemd-devel] FC16 - how to get ExecStop= to be executed at shutdown?
On 12/04/2011 03:53 PM, Josh Geisser wrote:
Hi,
> I succeeded with auto login and auto start of my Virtual Boxes, but could not get them to do a proper shutdown.
>
> Because of the nature of the VM processes I want to send them a proper ACPI shutdown button instead of terminating the process, which is done through my old rc-script.
>
> The VirtualBoxes process are started AFTER X11 is up, but must also be shutdown BEFORE the display-manager is exited.
>
> How do I configure this in the service file?
You already have this property, because After is reversed during shutdown.
From systemd.unit(5):
Note that when two units with an ordering dependency between them are
shut down, the inverse of the start-up order is applied. i.e. if a unit
is configured with After= on another unit, the former is stopped before
the latter if both are shut down.
>
> My /lib/systemd/system/vbox.service:
>
> [Unit]
> Description=Virtual Box Machines
> After=vboxdrv.service network.target display-manager.service
>
> [Service]
> Type=forking
> ExecStart=/home/vmuser/./rc.virtualboxes start | /usr/bin/logger
> ExecStop=/home/vmuser/./rc.virtualboxes stop | /usr/bin/logger
Those two lines are wrong. ExecStart is justed exec()ed, not through the
shell. What happens here, is that the script gets three arguments
"start", "|", "/usr/bin/logger". It likely ignores everything but $1, so
it seems to work.
You might use StandardOutput= (see systemd.exec(5)), or just leave the
redirection out entirely, it is now the default to redirect stdout to
syslog.
Best,
Zbyszek
> [Install]
> WantedBy=graphical.target
>
>
> Cheers& thx
> Josh
>
_______________________________________________
systemd-devel mailing list
systemd-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
----
ASG at hnet
More information about the systemd-devel
mailing list