Re: [systemd-devel] Reliable way to finish system units before termination through systemd shutdown / reboot routines

2017-08-15 Thread Reindl Harald



Am 15.08.2017 um 16:25 schrieb Reiner Wenke:

I have running some virtualbox instances under systemd control and use 
vboxautostart-service
for starting and stopping (saving). This is running on Centos7
As long as I use systemctl stop vboxautostart-service for termination, 
everything is fine,
but it takes some time for completion.

If I shutdown or reboot the host system, then I get a premature kill of all 
running instances,
most likely through the systemd reboot / shutdown routines .
I tried some configuration changes, but nothing worked for me.

Is there a reliable way to avoid this behavior?


you need to remember that the sequence of shutdown is the exactly verse 
of startup to begin with and adjust "TimeoutStopSec" in case running 
guests are suspended at shutdown


i finally throwed away anything from VMware Workstation including the 
module-load stuffm dhcp and so on and solved it with own services, 
tragtes and dependencies - below a part of the unit files to get an idea



[root@srv-rhsoft:~]$ cat /etc/systemd/system/vmware-guest.target
[Unit]
Description=VMware Guest Group
After=vmware.service vmware.target network-wan-bridge.service 
display-manager.service

Requires=vmware.service vmware-modules.service vmware-vmnet.service
Wants=guest-arrakis.service
Wants=guest-testserver.service
Wants=display-manager.service

[Install]
WantedBy=graphical.target


[root@srv-rhsoft:~]$ cat /etc/systemd/system/vmware.service
[Unit]
Description=VMware Workstation Service
Requires=vmware-modules.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/systemctl start vmware.target
ExecStop=-/scripts/vmware/vm-suspend-all.sh
ExecStop=/usr/bin/systemctl stop vmware.target
TimeoutSec=1800
TimeoutStopSec=1800
ReadOnlyDirectories=/etc
ReadOnlyDirectories=/usr
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_WRITE CAP_SYS_ADMIN 
CAP_SYS_BOOT CAP_SYS_PTRACE


[Install]
WantedBy=multi-user.target


[root@srv-rhsoft:~]$ cat /etc/systemd/system/vmware.target
[Unit]
Description=VMware Service Group
Requires=vmware-modules.service vmware-vmnet.service
Wants=vmware-authentication.service
Wants=vmware-usb.service

[Install]
WantedBy=multi-user.target
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] type=notify not working as intended

2017-08-15 Thread Reindl Harald



Am 15.08.2017 um 05:59 schrieb Kalpa Gunarathna:

Hello all,

I have scripted a service unit as follow.

[Unit]
Description="A test service"
After=epmd.service epmd.socket

[Service]
ExecStart=/home/otpuser/bin/start
Type=notify
NotifyAccess=all
WorkingDirectory=~
User=otpuser
Group=otp
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target


ExecStart directs to a shell script which starts a Erlang run_erl daemon.
This daemon is forking a process which is the BEAM virtual machine. In 
the forked process Im sending "READY=1\nSTATUS=Initialized\nMAINPID=" 
<> "\n to systemd via sd_notify. The problem is 
service is getting restarted constantly


MAINPID is supposed to send the notify
Type=notify needs to be explicit supported by the daemon

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel