After uploading a plugin (check_apc_pdu_load.sh for example), the following error is produced:
The following error message is produced:
-bash: ./check_apc_pdu_load.sh: /bin/bash^M: bad interpreter: No such file or directory
This is caused by the file being in a "Windows" format instead of a "Unix" format. It has to do with the line endings / carriage returns.
To resolve the problem you will convert the file to a Unix format. Execute the following steps from an SSH session as a user with root privileges.
The first step is to install the required package:
RHEL | CentOS | Oracle Linux
yum install -y dos2unix
Debian | Ubuntu
apt-get install -y dos2unix
The next step is to convert the file to a Unix format:
dos2unix /usr/local/nagios/libexec/check_apc_pdu_load.sh
This will output:
dos2unix: converting file /usr/local/nagios/libexec/check_apc_pdu_load.sh to UNIX format ...
After completing these steps the plugin should execute as intended.
For any support related questions please visit the Nagios Support Forums at:
http://support.nagios.com/forum/
Article ID: 474
Created On: Thu, Feb 25, 2016 at 12:26 AM
Last Updated On: Tue, Dec 18, 2018 at 5:33 PM
Authored by: tlea
Online URL: https://support.nagios.com/kb/article/nagios-xi-uploaded-plugin-returns-bin-bash^m-bad-interpreter-no-such-file-or-directory-474.html