Strange "program/file does not exist" error

Steven Christensen <[email protected]> Wed, 9 Apr 2025 17:50:30 -0400
Newsgroups gmane.comp.monitoring.monit.general
Message-ID <CAPf-+SeifED7ab=_qQMZNi=h2mz8buQfdAXk_gDhbU3CdV1X4w@mail.gmail.com>
--000000000000fb814b06325f75c4
Content-Type: text/plain; charset="UTF-8"

I have a new Ubuntu VM and I installed monit (version 5.33.0). I am
well-versed with monit, and run it on multiple platforms.

Anyway, I have a simple configuration to check for the existence of a
process, and if it is missing, start it.

Here is the configuration
=====================================
check process udptunnel matching "127.0.0.1:21116"
      start program = "/root/start_udptunnel.sh" with timeout 15 seconds
      stop program = "/usr/bin/pkill -f 'udptunnel -s 21000'"
=====================================

The start_udptunnel.sh script looks like this:
=====================================
#!/bin/bash -x

echo "Starting" | ts >> /tmp/udptunnel.log
/usr/local/sbin/udptunnel -s 21000 127.0.0.1:21116 -v 2>&1 | ts >>
/tmp/udptunnel.log &
exit 0
=====================================

Everything works when I invoke start_udptunnel.sh manually. The permissions
on start_udptunnel.sh are appropriate.

However, when I start up monit, this is in the log:
=====================================
[2025-04-09T16:21:08+0000] info     : Reinitializing monit daemon
[2025-04-09T16:21:08+0000] info     : Reinitializing Monit -- control file
'/etc/monit/monitrc'
[2025-04-09T16:21:09+0000] warning  : /etc/monit/conf-enabled/udptunnel:2:
Program does not exist: '/root/start_udptunnel.sh'
[2025-04-09T16:21:09+0000] info     : 'xxxxxxxx.com' Monit reloaded
[2025-04-09T16:21:20+0000] error    : 'udptunnel' process is not running
[2025-04-09T16:21:21+0000] info     : 'udptunnel' trying to restart
[2025-04-09T16:21:21+0000] info     : 'udptunnel' start:
'/root/start_udptunnel.sh'
[2025-04-09T16:21:21+0000] error    : 'udptunnel' failed to start (exit
status -1) -- Program /root/start_udptunnel.sh failed: File
'/root/start_udptunnel.sh' does not exist
=====================================

For the life of me I can't figure out why monit says that the script
doesn't exist.

I have copied and pasted the script name from the log just to make sure
there is no typo.

Am I missing something obvious?

Thanks

--000000000000fb814b06325f75c4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I have a new Ubuntu VM and I installed monit (version 5.33=
.0). I am well-versed with monit, and run it on multiple platforms.<div><br=
></div><div>Anyway, I have a simple configuration to check for the existenc=
e=C2=A0of a process, and if it is missing, start it.</div><div><br></div><d=
iv>Here is the configuration</div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
</div><div>check process udptunnel matching &quot;<a href=3D"http://127.0.0=
.1:21116">127.0.0.1:21116</a>&quot;<br>=C2=A0 =C2=A0 =C2=A0 start program =
=3D &quot;/root/start_udptunnel.sh&quot; with timeout 15 seconds<br>=C2=A0 =
=C2=A0 =C2=A0 stop program =3D &quot;/usr/bin/pkill -f &#39;udptunnel -s 21=
000&#39;&quot;<br></div><div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</d=
iv><div><br></div></div><div>The start_udptunnel.sh script looks like this:=
</div><div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div>#!/bin/bash -x<=
br><br>echo &quot;Starting&quot; | ts &gt;&gt; /tmp/udptunnel.log<br>/usr/l=
ocal/sbin/udptunnel -s 21000 <a href=3D"http://127.0.0.1:21116">127.0.0.1:2=
1116</a> -v 2&gt;&amp;1 | ts &gt;&gt; /tmp/udptunnel.log &amp;<br>exit 0<br=
><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><br class=3D"gmail-Apple-in=
terchange-newline"></div><div>Everything works when I invoke start_udptunne=
l.sh manually. The permissions on start_udptunnel.sh are appropriate.</div>=
<div><br></div><div>However, when I start up monit, this is in the log:</di=
v><div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</div><div>[2025-04-09T16:2=
1:08+0000] info =C2=A0 =C2=A0 : Reinitializing monit daemon<br>[2025-04-09T=
16:21:08+0000] info =C2=A0 =C2=A0 : Reinitializing Monit -- control file &#=
39;/etc/monit/monitrc&#39;<br>[2025-04-09T16:21:09+0000] warning =C2=A0: /e=
tc/monit/conf-enabled/udptunnel:2: Program does not exist: &#39;/root/start=
_udptunnel.sh&#39;<br>[2025-04-09T16:21:09+0000] info =C2=A0 =C2=A0 : &#39;=
<a href=3D"http://xxxxxxxx.com">xxxxxxxx.com</a>&#39; Monit reloaded<br>[20=
25-04-09T16:21:20+0000] error =C2=A0 =C2=A0: &#39;udptunnel&#39; process is=
 not running<br>[2025-04-09T16:21:21+0000] info =C2=A0 =C2=A0 : &#39;udptun=
nel&#39; trying to restart<br>[2025-04-09T16:21:21+0000] info =C2=A0 =C2=A0=
 : &#39;udptunnel&#39; start: &#39;/root/start_udptunnel.sh&#39;<br>[2025-0=
4-09T16:21:21+0000] error =C2=A0 =C2=A0: &#39;udptunnel&#39; failed to star=
t (exit status -1) -- Program /root/start_udptunnel.sh failed: File &#39;/r=
oot/start_udptunnel.sh&#39; does not exist</div><div>=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D<br></div><br class=3D"gmail-Apple-interchange-newline"></di=
v><div>For the life of me I can&#39;t figure out why monit says that the sc=
ript doesn&#39;t=C2=A0exist.</div><div><br></div><div>I have copied and pas=
ted the script name from the log just to make sure there is no typo.</div><=
div><br></div><div>Am I missing something obvious?</div><div><br></div><div=
>Thanks</div></div>

--000000000000fb814b06325f75c4--