[systemd-devel] Question regarding the NotifyAccess parameter

salil GK gksalil at gmail.com
Sun Dec 8 20:17:56 PST 2013


Hello

   did any body get a chance to look into this. I am a kind of stuck on
this. I can work around using ExecStartPre script where I can kill the
previous instances. But if systemd is capable to do  it by itself, that
would be the neat solution.

Thanks
~S


On 5 December 2013 13:19, salil GK <gksalil at gmail.com> wrote:

> Hello
>
>  I am using Fedora 19 and systemd in it is 204 I guess. The issue is
> present in there. The following is whatmy unit file is
>
> >>>>
> cat /usr/lib/systemd/system/Myservice.service
> [Unit]
> Description=This is a test service
>
> [Service]
> #PIDFile=/var/run/Myservice.pid
> #ExecStartPre=/tmp/one_start_pre.sh
> #ExecStartPre=/bin/systemctl stop Myservice
> ExecStartPost=/tmp/one_start_post.sh
> #ExecStartPre=/usr/bin/systemctl stop Myservice
> RemainAfterExit=yes
>
> ExecStart=/tmp/one.sh
> *Restart=on-failure*
> NotifyAccess=all
> WatchdogSec=10
> User=admin
> Group=admin
>
> [Install]
> Alias=myservice.services
>
> <<<<<
>
> systemctl output
>
> >>>
>
> sudo systemctl status Myservice
> Myservice.service - This is a test service
>    Loaded: loaded (/usr/lib/systemd/system/Myservice.service; disabled)
>    Active: active (running) since Thu 2013-12-05 18:39:36 IST; 1s ago
>   Process: 20968 ExecStartPost=/tmp/one_start_post.sh (code=exited,
> status=0/SUCCESS)
>  Main PID: 20967 (one.sh)
>    CGroup: name=systemd:/system/Myservice.service
>            ├─*20967* /bin/bash /tmp/one.sh
>            └─20971 sleep 5
>
>
> After some time I made the watchdog timer fail.
>
> sudo systemctl status Myservice
> Myservice.service - This is a test service
>    Loaded: loaded (/usr/lib/systemd/system/Myservice.service; disabled)
>    Active: active (running) since Thu 2013-12-05 18:40:52 IST; 2s ago
>   Process: 21180 ExecStartPost=/tmp/one_start_post.sh (code=exited,
> status=0/SUCCESS)
>  Main PID: 21179 (one.sh)
>    CGroup: name=systemd:/system/Myservice.service
>            ├─*20967* /bin/bash /tmp/one.sh
>            ├─21006 /bin/bash /tmp/one.sh
>            ├─21030 /bin/bash /tmp/one.sh
>            ├─21058 /bin/bash /tmp/one.sh
>            ├─21092 /bin/bash /tmp/one.sh
>            ├─21133 /bin/bash /tmp/one.sh
>            ├─21166 sleep 5
>            ├─21169 sleep 5
>            ├─21172 sleep 5
>            ├─21175 sleep 5
>            ├─21178 sleep 5
>            ├─21179 /bin/bash /tmp/one.sh
>            ├─21184 sleep 5
>            └─21191 sleep 5
>
>
> <<<<<<
>
> $$ ] systemctl --version
> systemd 204
> +PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL
> +XZ
>
> Thanks
> Salil
>
>
>
> On 26 November 2013 20:27, Hoyer, Marko (ADITG/SW2) <mhoyer at de.adit-jv.com
> > wrote:
>
>> > >    One more issue I observed is - if I specify Restart=on-failure, if
>> > > watchdog timer expire, it restart the service. But I can see that it
>> > > create two processes rather than restarting the process. But if I do
>> > > systemctl restart Myservice , it kills the previous instance of
>> > > service and start a new service. Any pointers on why it happens so.
>>
>> This part has been already reported as a bug in May:
>> http://lists.freedesktop.org/archives/systemd-devel/2013-May/011030.html
>>
>> Best to my knowledge, this has been fixed in systemd 203, 204, or 205 ...
>> Please note that the link above does not contain the final bug fix. Some
>> discussions followed which led to the final solution at a certain point.
>> Follow the threads, you'll find it ...
>>
>>
>> Best regards
>>
>> Marko Hoyer
>> Software Group II (ADITG/SW2)
>>
>> Tel. +49 5121 49 6948
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131209/106d3de9/attachment.html>


More information about the systemd-devel mailing list