Re: [systemd-devel] blocking service on shutdown

2018-09-02 Thread Reindl Harald


Am 03.09.18 um 00:04 schrieb Amit Saha:
> 
> I had to achieve something similar a while back and this is how I ended
> up doing: 
> 
> https://echorand.me/doing-something-before-systemd-shuts-your-supervisord-down.html

when "ExecStop=/bin/sleep 300" is the solution if want my problems back
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] blocking service on shutdown

2018-09-02 Thread Amit Saha
Hi Ralf,

On Sun, 2 Sep 2018 at 11:40 pm, Ralf Sieger  wrote:

> Hi,
>
> I want my system to pause on shutdown to wait till my backup has finished
> if it is running.
> For this I've created this small service:
>
> [Unit]
> Description=borg shutdown wait
> [Service]
> Type=oneshot
> ExecStart=/bin/true
> RemainAfterExit=true
> ExecStop=/usr/local/bin/wait_borg
> TimeoutStopSec=600
> [Install]
> WantedBy=multi-user.target
>
> I'm using ubuntu 18.04, systemd 237
>
> Manually stopping the service via
> systemctl stop borg_wrapper
> does wait and thus works.
>
> But its not working on normal shutdown/poweroff ...
> From the logs I can't even see an entry with
> "Stopping borg shutdown wait" in syslog.
>
> Does anyone has an idea?
>

I had to achieve something similar a while back and this is how I ended up
doing:

https://echorand.me/doing-something-before-systemd-shuts-your-supervisord-down.html

Hope it helps.



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


Re: [systemd-devel] blocking service on shutdown

2018-09-02 Thread Reindl Harald


Am 02.09.18 um 16:41 schrieb Ralf Sieger:
> Hi Harald,
>  
>> what exactly does "/usr/local/bin/wait_borg"?
> Small script which terminates whn no "borg" processes exist any more.
> 
>> why are the no dependecnies to the services it waits for?
> The process it waits for is not a service but a normal user program.
>  
>> "TimeoutStopSec=600" alone does nothing then prevent systemd kills the
>> whole service bfore that timeout is reached at shutdown
> You mean at shutdown this timeout is ignored?

no, i did not say that - i said it's the timeout after ExecStop will be
killed

the service below waits as expected until ExecStop has finish which is
when VMare Workstation powered off the guest after shtdown within it
triggered by open-vm-tools and has a limit of 5 minutes to do so

--

[root@srv-rhsoft:~]$ cat /etc/systemd/system/guest-testserver.service
[Unit]
Description=VMware-Guest Testserver
PartOf=vmware-guest.target
Requisite=vmware.service
After=vmware-vmnet.service iptables.service

[Service]
Type=oneshot
RemainAfterExit=yes
Nice=19
IOSchedulingClass=idle
User=vmware
Group=vmware
ExecStart=/usr/bin/vmrun -T ws start '/vms/testserver/config.vmx' nogui
ExecReload=-/usr/bin/vmrun -T ws reset '/vms/testserver/config.vmx'
nogui soft
ExecStop=-/usr/bin/vmrun -T ws stop '/vms/testserver/config.vmx' nogui soft
TimeoutSec=300
ReadOnlyPaths=/etc
ReadOnlyPaths=/usr
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_WRITE CAP_SYS_ADMIN
CAP_SYS_BOOT CAP_SYS_PTRACE

IPAddressDeny=any
IPAddressAllow=localhost

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


Re: [systemd-devel] blocking service on shutdown

2018-09-02 Thread Michael Biebl
2018-09-02 15:37 GMT+02:00 Ralf Sieger :
> Hi,
>
> I want my system to pause on shutdown to wait till my backup has finished if
> it is running.

I would suggest using an inhibitor lock when running your backup.
See https://www.freedesktop.org/wiki/Software/systemd/inhibit/

That's exactly the use-case it was designed for.


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] blocking service on shutdown

2018-09-02 Thread Ralf Sieger

Hi Harald,
 


> what exactly does "/usr/local/bin/wait_borg"?

Small script which terminates whn no "borg" processes exist any more.


> why are the no dependecnies to the services it waits for?

The process it waits for is not a service but a normal user program.

 

> "TimeoutStopSec=600" alone does nothing then prevent systemd kills the
> whole service bfore that timeout is reached at shutdown

You mean at shutdown this timeout is ignored?

 

Regards,

Ralf


 
 

 

Gesendet: Sonntag, 02. September 2018 um 16:17 Uhr
Von: "Reindl Harald" 
An: systemd-devel@lists.freedesktop.org
Betreff: Re: [systemd-devel] blocking service on shutdown



Am 02.09.18 um 15:37 schrieb Ralf Sieger:
> I want my system to pause on shutdown to wait till my backup has
> finished if it is running.
> For this I've created this small service:
>  
> [Unit]
> Description=borg shutdown wait
> [Service]
> Type=oneshot
> ExecStart=/bin/true
> RemainAfterExit=true
> ExecStop=/usr/local/bin/wait_borg
> TimeoutStopSec=600
> [Install]
> WantedBy=multi-user.target
>  
> I'm using ubuntu 18.04, systemd 237
>  
> Manually stopping the service via
> systemctl stop borg_wrapper
> does wait and thus works.
>  
> But its not working on normal shutdown/poweroff ...
> From the logs I can't even see an entry with
> "Stopping borg shutdown wait" in syslog.
>  
> Does anyone has an idea?

what exactly does "/usr/local/bin/wait_borg"?
why are the no dependecnies to the services it waits for?

"TimeoutStopSec=600" alone does nothing then prevent systemd kills the
whole service bfore that timeout is reached at shutdown
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



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


Re: [systemd-devel] blocking service on shutdown

2018-09-02 Thread Reindl Harald


Am 02.09.18 um 15:37 schrieb Ralf Sieger:
> I want my system to pause on shutdown to wait till my backup has
> finished if it is running.
> For this I've created this small service:
>  
> [Unit]
> Description=borg shutdown wait
> [Service]
> Type=oneshot
> ExecStart=/bin/true
> RemainAfterExit=true
> ExecStop=/usr/local/bin/wait_borg
> TimeoutStopSec=600
> [Install]
> WantedBy=multi-user.target
>  
> I'm using ubuntu 18.04, systemd 237
>  
> Manually stopping the service via
> systemctl stop borg_wrapper
> does wait and thus works.
>  
> But its not working on normal shutdown/poweroff ...
> From the logs I can't even see an entry with
> "Stopping borg shutdown wait" in syslog.
>  
> Does anyone has an idea?

what exactly does "/usr/local/bin/wait_borg"?
why are the no dependecnies to the services it waits for?

"TimeoutStopSec=600" alone does nothing then prevent systemd kills the
whole service bfore that timeout is reached at shutdown
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] blocking service on shutdown

2018-09-02 Thread Ralf Sieger
Hi,

 

I want my system to pause on shutdown to wait till my backup has finished if it is running.

For this I've created this small service:

 


[Unit]
Description=borg shutdown wait

[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=true

ExecStop=/usr/local/bin/wait_borg
TimeoutStopSec=600

[Install]
WantedBy=multi-user.target

 

I'm using ubuntu 18.04, systemd 237

 

Manually stopping the service via

systemctl stop borg_wrapper

does wait and thus works.

 

But its not working on normal shutdown/poweroff ...

From the logs I can't even see an entry with

"Stopping borg shutdown wait" in syslog.

 

Does anyone has an idea?

 


Regards,

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