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

Warpme warpme at o2.pl
Wed Jul 27 23:37:32 PDT 2011


On 7/27/11 11:19 PM, Kok, Auke-jan H wrote:
> 2011/7/27 Warpme<warpme at 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.
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.

I believe more elegant will be use systemctl in proc1 unit to force 
restart of proc2

Is there better way to do this ?

br
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warpme.vcf
Type: text/x-vcard
Size: 83 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20110728/b4dd5b3f/attachment.vcf>


More information about the systemd-devel mailing list