Comment 3 for bug 1971156

Revision history for this message
Xav Paice (xavpaice) wrote :

Looking at the action script (which is written in bash):

root@juju-da6b2f-nrpe-0:/home/ubuntu# check=check_reboot
root@juju-da6b2f-nrpe-0:/home/ubuntu# nrpedir="/etc/nagios/nrpe.d"
root@juju-da6b2f-nrpe-0:/home/ubuntu# checkfile="$nrpedir/${check}.cfg"
root@juju-da6b2f-nrpe-0:/home/ubuntu# command=$(awk -F "=" '{ print $2 }' $checkfile)
root@juju-da6b2f-nrpe-0:/home/ubuntu# echo $command
/usr/local/lib/nagios/plugins/check_reboot.py "2022-05-03 05:12:03"

root@juju-da6b2f-nrpe-0:/home/ubuntu# sudo -u nagios $command
usage: check_reboot.py [-h] known_reboot_time
check_reboot.py: error: argument known_reboot_time: time must be in format yyyy-mm-dd HH:MM:SS, same as output from `uptime --since`.

root@juju-da6b2f-nrpe-0:/home/ubuntu# echo $command |xargs sudo -u nagios
OK: system is up since 2022-05-03 05:12:03

This is about the way bash passes args and quotes.