Hello Steven,

it's because of Ubuntu's systemd hardening setup since Ubuntu 24.04, please see 
here for more details and solution: https://mmonit.com/wiki/Monit/FAQ#hardening

Best regards,
The M/Monit team


> On 9. 4. 2025, at 23:50, Steven Christensen <ste...@c88.org> wrote:
> 
> 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 <http://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 <http://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 <http://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

Reply via email to