[systemd-devel] customized shutdown service needed

Reindl Harald h.reindl at thelounge.net
Fri Jan 24 16:01:11 PST 2014


Am 29.02.2012 17:16, schrieb Lennart Poettering:
> On Sun, 26.02.12 19:13, Reindl Harald (h.reindl at thelounge.net) wrote:
> 
>> the ExecStop is called but systemd DOES NOT wait
>> until it is finished leading to all virtual machines
>> are killed hard while "systemctl stop vmware-default.service"
>> does supsend them perfectlly as long it is not combined with
>> any sort of shutdown
> 
> systemd waits for ExecStop= to finish before executing later jobs (well,
> subject to a timeout, of a couple of minutes).
> 
> What really matters is that you order your service before/after the
> right things, and be aware that:
> 
> a) the stop order is implicitly the reverse of the start order
> 
> b) if a job is started and another one stopped and they are ordered
> against each other, then the stop is executed first, and the start
> executed second, regardless which kind of ordering is actually
> configured

by the way - somewhere around Fedora 18 without change anything
on my side systemd no longer kills ExecStop and so suspending
VM's, meaning this was clearly a systemd bug as i reported it

ExecStartPost=-/usr/bin/su -c "/scripts/vmware/vm-default-start.sh" vmware
ExecStop=-/scripts/vmware/vm-suspend-all.sh

[root at srv-rhsoft:~]$ cat /scripts/vmware/vm-suspend-all.sh
#!/usr/bin/bash
if [ -x /usr/bin/vmrun ] ; then
 for i in `pidof vmware-vmx` ; do
  VMX_PATH=`ps -p $i -f | sed -ne '/vmware/s/.* \(\/.*\.vmx\)/\1/p'`
  /usr/bin/logger -t vmware "SUSPEND: $VMX_PATH"
  /usr/bin/vmrun suspend `ps -p $i -f | sed -ne '/vmware/s/.* \(\/.*\.vmx\)/\1/p'` 2> /dev/null
  /usr/bin/logger -t vmware "SUSPENDED: $VMX_PATH"
 done
fi
/usr/bin/bash /vmware/permissions.sh
exit 0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 246 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140125/e8c044dc/attachment.pgp>


More information about the systemd-devel mailing list