On Wed, Jul 22, 2020 at 4:58 PM Ken Gaillot <kgail...@redhat.com> wrote:
> On Wed, 2020-07-22 at 10:59 +0300, Хиль Эдуард wrote: > > Hi there! I have 2 nodes with Pacemaker 2.0.3, corosync 3.0.3 on > > ubuntu 20 + 1 qdevice. I want to define new resource as systemd > > unit dummy.service : > > > > [Unit] > > Description=Dummy > > [Service] > > Restart=on-failure > > StartLimitInterval=20 > > StartLimitBurst=5 > > TimeoutStartSec=0 > > RestartSec=5 > > Environment="HOME=/root" > > SyslogIdentifier=dummy > > ExecStart=/usr/local/sbin/dummy.sh > > [Install] > > WantedBy=multi-user.target > > > > and /usr/local/sbin/dummy.sh : > > > > #!/bin/bash > > CNT=0 > > while true; do > > let CNT++ > > echo "hello world $CNT" > > sleep 5 > > done > > > > and then i try to define it with: pcs resource create dummy.service > > systemd:dummy op monitor interval="10s" timeout="15s" > > after 2 seconds node2 reboot. In logs i see pacemaker in 2 seconds > > tried to start this unit, and it started, but pacemaker somehow think > > he is «Timed Out» . What i am doing wrong? Logs below. > > The start is timing out because the ExecStart script never returns. > > Type=simple does not expect script to go into background. Quite the contrary - systemd expects ExecStart command to remain, going into background would be interpreted as "service terminated". To quote systemd: "the service manager will consider the unit started immediately after the main service process has been forked off. It is expected that the process configured with ExecStart= is the main process of the service". > systemd starts processes but it doesn't daemonize them -- the script is > responsible for doing that itself. Only for Type=forking > You can search online for more > details about daemonization, but most importantly you want to run your > daemon as a subprocess in the background and have your main process > return as soon as the daemon is ready for service. > > > > Jul 21 15:53:41 node2.local pacemaker-controld[1813]: notice: Result > > of probe operation for dummy.service on node2.local: 7 (not running) > > Jul 21 15:53:41 node2.local systemd[1]: Reloading. > > Jul 21 15:53:42 node2.local systemd[1]: > > /lib/systemd/system/dbus.socket:5: ListenStream= references a path > > below legacy directory /var/run/, updating > > /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please > > update the unit file accordingly. > > Jul 21 15:53:42 node2.local systemd[1]: > > /lib/systemd/system/docker.socket:6: ListenStream= references a path > > below legacy directory /var/run/, updating /var/run/docker.sock → > > /run/docker.sock; please update the unit file accordingly. > > Jul 21 15:53:42 node2.local pacemaker-execd[1808]: notice: Giving up > > on dummy.service start (rc=0): timeout (elapsed=259719ms, remaining=- > > 159719ms) > > Jul 21 15:53:42 node2.local pacemaker-controld[1813]: error: Result > > of start operation for dummy.service on node2.local: Timed Out > > Jul 21 15:53:42 node2.local systemd[1]: Started Cluster Controlled > > dummy. > > Jul 21 15:53:42 node2.local dummy[9330]: hello world 1 > > Jul 21 15:53:42 node2.local systemd-udevd[922]: Network interface > > NamePolicy= disabled on kernel command line, ignoring. > > Jul 21 15:53:42 node2.local pacemaker-attrd[1809]: notice: Setting > > fail-count-dummy.service#start_0[node2.local]: (unset) -> INFINITY > > Jul 21 15:53:42 node2.local pacemaker-attrd[1809]: notice: Setting > > last-failure-dummy.service#start_0[node2.local]: (unset) -> > > 1595336022 > > Jul 21 15:53:42 node2.local systemd[1]: Reloading. > > Jul 21 15:53:42 node2.local systemd[1]: > > /lib/systemd/system/dbus.socket:5: ListenStream= references a path > > below legacy directory /var/run/, updating > > /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please > > update the unit file accordingly. > > Jul 21 15:53:42 node2.local systemd[1]: > > /lib/systemd/system/docker.socket:6: ListenStream= references a path > > below legacy directory /var/run/, updating /var/run/docker.sock → > > /run/docker.sock; please update the unit file accordingly. > > Jul 21 15:53:42 node2.local pacemaker-execd[1808]: notice: Giving up > > on dummy.service stop (rc=0): timeout (elapsed=317181ms, remaining=- > > 217181ms) > > Jul 21 15:53:42 node2.local pacemaker-controld[1813]: error: Result > > of stop operation for dummy.service on node2.local: Timed Out > > Jul 21 15:53:42 node2.local systemd[1]: Stopping Daemon for dummy... > > Jul 21 15:53:42 node2.local pacemaker-attrd[1809]: notice: Setting > > fail-count-dummy.service#stop_0[node2.local]: (unset) -> INFINITY > > Jul 21 15:53:42 node2.local pacemaker-attrd[1809]: notice: Setting > > last-failure-dummy.service#stop_0[node2.local]: (unset) -> > > 1595336022 > > Jul 21 15:53:42 node2.local systemd[1]: dummy.service: Succeeded. > > Jul 21 15:53:42 node2.local systemd[1]: Stopped Daemon for dummy. > > ... lost connection (node rebooting) > > > > > > _______________________________________________ > > Manage your subscription: > > https://lists.clusterlabs.org/mailman/listinfo/users > > > > ClusterLabs home: https://www.clusterlabs.org/ > -- > Ken Gaillot <kgail...@redhat.com> > > _______________________________________________ > Manage your subscription: > https://lists.clusterlabs.org/mailman/listinfo/users > > ClusterLabs home: https://www.clusterlabs.org/ >
_______________________________________________ Manage your subscription: https://lists.clusterlabs.org/mailman/listinfo/users ClusterLabs home: https://www.clusterlabs.org/