Re: [systemd-devel] Hand when using systemctl in unit files

2011-08-02 Thread Warpme

On 8/2/11 1:02 AM, Lennart Poettering wrote:

On Thu, 28.07.11 15:20, warpme (war...@o2.pl) wrote:


Zbyszek,

Thx for replay.
You touch exactly the point.


You can use more than one ExecStartPost. E.g.
  ExecStartPost=sleep 10
  ExecStartPost=systemctl try-restart proc2
This way you remove the unnecessary delay when starting proc2.

This is exactly way how I want to implement this.
Issue is that in systemd-29 it seems to impossible to successfully call 
systemctl from unit files.
Processing of such unit simply hangs.
I get impression systemctl can't be called recurrently.

It can. We do that by default in rsyslog.service for example. But you
need to make sure not to add deadlocks with that, or only trigger but
not synchonously wait for your operations. Use systemctl
--no-block for that.

Lennart


Lennart,

Thx You find time to replay to my e-mail.
I REALLY like systemd concept. Usage of cgroups was plainly perfect move.
This is one form most elegant subsystems I found in Linux !
It is great You are contributing to Linux.

Having chance to talk with You and having access to Your experience: I'm 
curious Your opinion what distro You will advice me if I want to have 
highest stability but also high freshness in components (kernel  mysql 
is key). I'm asking as I have very unusual issue related to client side 
of mysql and after trying various tweaks, kernels  mysql I'm out of 
ideas :-(


-br

attachment: warpme.vcf___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Hand when using systemctl in unit files

2011-08-01 Thread Lennart Poettering
On Wed, 27.07.11 22:05, Warpme (war...@o2.pl) wrote:

 Hi,
 I really like systemd concept.
 I want to use systemctl to control other unit from given unit.
 I'm on systemd-29
 
 Example:
 
 unit1:
 ExecStartPre=systemctl restart service2.service

This won't work since we only allow absolute file names in ExecXXX=
lines.

Note that this will necessarily deadlock if service2.service is ordered
after unit1, since you synchronously wait for service2 to restart, which
however cannot be started as long as unit1 isn't fully up, which however
won't be up until service2 is finished restarting, which however won't
finish starting since unit1 won't finish and is ordered after it becuase


You get the idea I hope.

 Issuing systemctl restart unit1.service gives hang on this command
 (I have to terminate manually systemctl)
 While I don't know is this by design behavior or not - I think it
 would be nice to have possibility to control units from other units

systemd provides you with this flexibility. But you need to get your
ordering right.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Hand when using systemctl in unit files

2011-08-01 Thread Lennart Poettering
On Thu, 28.07.11 15:20, warpme (war...@o2.pl) wrote:

 
 Zbyszek,
 
 Thx for replay.
 You touch exactly the point.
 
 You can use more than one ExecStartPost. E.g.
   ExecStartPost=sleep 10
   ExecStartPost=systemctl try-restart proc2
 This way you remove the unnecessary delay when starting proc2.
 
 This is exactly way how I want to implement this.
 Issue is that in systemd-29 it seems to impossible to successfully call 
 systemctl from unit files. 
 Processing of such unit simply hangs.
 I get impression systemctl can't be called recurrently.

It can. We do that by default in rsyslog.service for example. But you
need to make sure not to add deadlocks with that, or only trigger but
not synchonously wait for your operations. Use systemctl
--no-block for that.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Hand when using systemctl in unit files

2011-07-28 Thread Zbigniew Jędrzejewski-Szmek
On 07/28/2011 08:37 AM, Warpme wrote:
 On 7/27/11 11:19 PM, Kok, Auke-jan H wrote:
 2011/7/27 Warpmewar...@o2.pl:
 Hi,
 I really like systemd concept.
 I want to use systemctl to control other unit from given unit.
 I'm on systemd-29

 Example:

 unit1:
 ExecStartPre=systemctl restart service2.service

 Issuing systemctl restart unit1.service gives hang on this command
 (I have
 to terminate manually systemctl)
 While I don't know is this by design behavior or not - I think it
 would be
 nice to have possibility to control units from other units
 Can you explain why you need this? This sounds like you have a broken
 design to begin with, and you're masking it with something that is
 even more broken. Please try to use more arguments than nice to have
 but give a real example.

 Auke

 Hi,
 Thx for replay.
 Indeed probably my approach is suboptimal but currently I can't find
 better solution.
Hi,
to give a more concrete example: proc2=tracd using proc1=postgresql as a
backend requires a restart after the database daemon is restarted,
because it doesn't reopen the connection. A really ugly and painful
example seen in the wild.

A proper fix would be to make proc2 fail after a few attempts without
successful communication. Then proc2 could be reconfigured to
Restart=always and changed from Wants=proc1 to Requires=proc1.
I think that this would be more robust than delayed restarting that you
describe.

 Usecase if following:
 
 My server has some services which are servers for other services.
 e.g. proc1 is required to operate for proc2. Abort of proc1 requires
 ordered restart of proc2 with given delay.
 
 Currently my implementation is quite dumb:
 -I'm terminating proc2 via proc1's ExecStartPost killall proc2
 -proc2 have ExecStartPre with sleep delay
 Issue with such approach is that I have always delay when proc2 starts.

You can use more than one ExecStartPost. E.g.
  ExecStartPost=sleep 10
  ExecStartPost=systemctl try-restart proc2
This way you remove the unnecessary delay when starting proc2.

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


[systemd-devel] Hand when using systemctl in unit files

2011-07-27 Thread Warpme

Hi,
I really like systemd concept.
I want to use systemctl to control other unit from given unit.
I'm on systemd-29

Example:

unit1:
ExecStartPre=systemctl restart service2.service

Issuing systemctl restart unit1.service gives hang on this command (I 
have to terminate manually systemctl)
While I don't know is this by design behavior or not - I think it would 
be nice to have possibility to control units from other units


br

attachment: warpme.vcf___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel