i have an issue executing a PHP Script (chmod 777 nagios:nagios) as CRON.
The sh command inside the PHP script is the following:
ssh nagios@$host /backup/nagios/counter.sh
The problem is, when i run the PHP script in my local host with:
./counter_script.php 172.28.39.138
The result is showing fine on PuTTY if i run like that, but when i add the script to the crontab like:
*/5 * * * * /usr/local/nagios/homemade/counter_script.php 172.28.39.138 > /usr/local/nagios/homemade/outputest.txt
the Script wont run the remote SH and the test .txt file say Cant Connect to Remote host.
So the output in Nagios Portal is displaying a Connection Issue status too.
I can connect via SSH directly to/from both Host in PuTTY. I copied the public keys like always with this command using nagios user:
ssh-copy-id -i /home/nagios/.ssh/id_rsa.pub nagios@172.28.39.138
Someone told me it is a SSH Authority issue but i cant fix it yet, any help will be great :)