Home » Categories » Multiple Categories

Nagios XI - Uploaded plugin returns "/bin/bash^M: bad interpreter: No such file or directory"

Problem Description

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.

 

Resolving The Problem

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.

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios XI - ERROR: PostgresQL not running - exiting
Viewed 377 times since Tue, Jan 26, 2016
Nagios XI - MySQL/MariaDB - Max Connections
Viewed 1640 times since Thu, Jun 2, 2016
Nagios XI - Configuration Applies, but still get "Configuration File Is Out Of Date" Error
Viewed 308 times since Tue, Jan 26, 2016
Nagios XI - MK Livestatus Problems With Mod-Gearman
Viewed 412 times since Thu, Feb 25, 2016
Nagios XI - SourceGuardian Errors 2009R1.2C
Viewed 358 times since Tue, Feb 2, 2016
Disabling Port 113 IDENT Requests
Viewed 454 times since Tue, Mar 12, 2019
Nagios XI - Resolving "Cannot connect to database" Error - Core Config Manager
Viewed 539 times since Mon, Jan 25, 2016
Nagios XI - Troubleshooting Reports
Viewed 388 times since Wed, Dec 5, 2018
Nagios XI - Reset Upgrade Status In Web Interface
Viewed 769 times since Tue, May 7, 2019
Nagios XI - Notifications Not Sending In XI 5.3.0
Viewed 383 times since Tue, Oct 4, 2016