Hi Tomasz, Thanks for pointing out the mistake. I actually missed the line "Type=notify" in the mail. I found the journalctl logs and from that I can make out the real problem is not about NOTIFY_SOCKET. It is about child process in my application *Myapp.*
Below given is my Service file. *[Unit]* *Description=Sd_notify example* *[Service]* *Type=notify* *ExecStart=/etc/Myapp* *[Install]* *WantedBy=multi-user.target* And in Myapp code my application is using fork() to create a child process. Because of which notification is not working correctly. This is error log *localhost systemd[1]: sd_example.service: Got notification message from PID 1270, but reception only permitted for main PID 1106* Is there any way from which we can force sd_notify to make use of Parent PID instead of child process. My sd_notify is after the fork() call, so I doubt sd_notify is called from child process. MyApp code snippet *int count = 0;* * cpid = fork();* * if (cpid < 0)* * {* * printf("vfork failed.");* * }* * if (cpid == 0)* * {* * count++;* * if(count == 1)* * {* * ret = sd_notify(0, "READY=1");* * printf("Return value = %d \n");* * }* * }* Regards, Raghavendra H R -- Regards, Raghavendra. H. R (Raghu) On Tue, Nov 8, 2016 at 5:15 PM, Tomasz Torcz <to...@pipebreaker.pl> wrote: > On Tue, Nov 08, 2016 at 05:01:59PM +0530, Raghavendra. H. R wrote: > > Hi All, > > > > I'm a newbie in Systemd init system and I'm exploring sd_notify which is > > basically used for notification purpose in SystemD. > > It is written “systemd” (all lowercase). > > > I have created one unit file which is of type "notify" and in my > > application I have written sd_notify(0, "READY=1"); from which SystemD > can > > be notified that my process in totally up and running. > > > > Below given is my Service file. > > > > *[Unit]* > > *Description=Sd_notify example* > > > > *[Service]* > > *ExecStart=/etc/Myapp* > > > This is not 'unit of type notify'. This is unit of type 'simple'. > Please read "man systemd.service" and paragraph Type= and choose > correctly. > > > > Need help in understanding what value should be set in the environment > > varaible NOTIFY_SOCKET. > > But there's no much information/documentation available on NOTIFY_SOCKET. > > NOTIFY_SOCKET is filled-in by systemd and it is available when you > correctly defined unit type. If you want to check it's value, you can > user getenv() inside you program and print the value. > I think amount of documentation about NOTIFY_SOCKET is enough, if > you think there's something specific missing, let us know. > > > -- > Tomasz Torcz "Never underestimate the bandwidth of a station > xmpp: zdzich...@chrome.pl wagon filled with backup tapes." -- Jim Gray > > _______________________________________________ > 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