chiark / gitweb /
service: imply NotifyAccess=main if WatchdogSec= is used
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Feb 2012 20:11:25 +0000 (21:11 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Feb 2012 20:11:25 +0000 (21:11 +0100)
man/systemd.service.xml
src/service.c

index 513b4e5900fc000c0df3619602edabb30bd86066..837a992ba4fa1f17f419e86ad73115699facd7df 100644 (file)
                                 below) should be set to open access to
                                 the notification socket provided by
                                 systemd. If
-                                <varname>NotifyAccess=</varname> is not
-                                set, it will implicitly be set to
+                                <varname>NotifyAccess=</varname> is
+                                not set, it will be implicitly set to
                                 <option>main</option>.</para>
                                 </listitem>
                         </varlistentry>
                                 time configured here will be passed to
                                 the executed service process in the
                                 <varname>WATCHDOG_USEC=</varname>
-                                environment variable. Defaults to 0s,
+                                environment variable. If
+                                this option is used
+                                <varname>NotifyAccess=</varname> (see
+                                below) should be set to open access to
+                                the notification socket provided by
+                                systemd. If
+                                <varname>NotifyAccess=</varname> is not
+                                set, it will be implicitly set to
+                                <option>main</option>. Defaults to 0,
                                 which disables this
                                 feature.</para></listitem>
                         </varlistentry>
                                 accepted. If <option>all</option> all
                                 services updates from all members of
                                 the service's control group are
-                                accepted. This option must be set to
+                                accepted. This option should be set to
                                 open access to the notification socket
                                 when using
-                                <varname>Type=notify</varname> (see above).</para></listitem>
+                                <varname>Type=notify</varname> or
+                                <varname>WatchdogUsec=</varname> (see
+                                above). If those options are used but
+                                <varname>NotifyAccess=</varname> not
+                                configured it will be implicitly set
+                                to
+                                <option>main</option>.</para></listitem>
                         </varlistentry>
 
                         <varlistentry>
index e782421389d9878b02ed009b9581ec1fc4732b7e..ec2725a7badb39c98159d22cbbfe960ba5c48d85 100644 (file)
@@ -1235,6 +1235,9 @@ static int service_load(Unit *u) {
                 if (s->type == SERVICE_NOTIFY && s->notify_access == NOTIFY_NONE)
                         s->notify_access = NOTIFY_MAIN;
 
+                if (s->watchdog_usec > 0 && s->notify_access == NOTIFY_NONE)
+                        s->notify_access = NOTIFY_MAIN;
+
                 if (s->type == SERVICE_DBUS || s->bus_name)
                         if ((r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true)) < 0)
                                 return r;