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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to