Page 1 of 1

Get Disk Info

Posted: Wed Sep 02, 2015 6:08 pm
by sailci
I have setup check_usolved_disks.php, it is executable, it is in /usr/local/nagios/libexec directory, permissions look correct (same as everything else in that directory). When I try to test it from the command line I get ./check_usolved_disks.php: /usr/bin/php^M: bad interpreter: No such file or directory. php is installed and /usr/bin/php also exists. I am new to Nagios and new to Linux so just looking for some thoughts as to what could be wrong with this. Thanks...

Re: Get Disk Info

Posted: Thu Sep 03, 2015 9:09 am
by hsmith
sailci wrote:I have setup check_usolved_disks.php, it is executable, it is in /usr/local/nagios/libexec directory, permissions look correct (same as everything else in that directory). When I try to test it from the command line I get ./check_usolved_disks.php: /usr/bin/php^M: bad interpreter: No such file or directory. php is installed and /usr/bin/php also exists. I am new to Nagios and new to Linux so just looking for some thoughts as to what could be wrong with this. Thanks...

Can you check the top of the file to make sure that the shebang (#!) line isn't messed up? I've noticed bad things have happened when I try pasting occasionally.

Re: Get Disk Info

Posted: Thu Sep 03, 2015 10:23 am
by sailci
#!/usr/bin/php
<?php

Is the top two lines. Looks right to me? when I do a which php it does return that path. I also tried php -f <path to file> --args -H localhost -C public -w90 -c 95 and it just gives me PHP usage instructions. I am obviously missing something.

Thanks...

Re: Get Disk Info

Posted: Thu Sep 03, 2015 10:33 am
by tmcdonald
http://stackoverflow.com/questions/1992 ... -directory

Basically you have some Windows-style line endings that are messing it up. You should be able to yum install dos2unix and run it against the file to fix it.

Re: Get Disk Info

Posted: Thu Sep 03, 2015 10:40 am
by sailci
Looks like that did the trick....thank you so much