Re: [Nagios-users] running a perl script.
Hello, Another way, you could use "dos2unix /filename/" command. It will clean non-printable characters. Regards. Marc Powell wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:nagios-users- [EMAIL PROTECTED] On Behalf Of Mark Thompson Sent: Wednesday, March 14, 2007 9:16 AM To: nagios-users@lists.sourceforge.net Subject: Re: [Nagios-users] running a perl script. The file was never on a win machine here. I opened the file with kwrite and vi and don't see the ^M in the text. They _are_ there or you wouldn't see the error. The problem is that it's not a printable character (carriage return) so kwrite and vi just aren't showing it. Try 'vi -b filename'. That will put vi in binary mode which will display everything in the file as a printable character (^M for [CTRL-M] in this case). vim, often used as a replacement for vi these days, seems to be better at automatically setting binary mode when necessary from my experience. -- Marc - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] running a perl script.
On Wed, 14 Mar 2007, Mark Thompson wrote: > The file was never on a win machine here. I opened the file with kwrite and > vi and don't see the ^M in the text. > "Marc Powell" <[EMAIL PROTECTED]> 03/14/07 8:04 AM >>> > The ^M is a non-printable character that the editor is hiding from you. It is a windows carriage return. Open up a shell and try to see if you can find dos2unix which dos2unix If it finds dos2unix then run it as follows to convert the ^M to the unix equivalent dos2unix filename After you've rid the file of the ^M you should be ok to run it. Now you should open your kwrite preferences and find out why it's using ^M for Carriage Returns. From the sounds of it, if you are going to use kwrite for writing unix scripts you will always encounter this problem unless you either correct kwrite preferences (assuming it's configurable), or start using a different editor. HTH. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] running a perl script.
> -Original Message- > From: [EMAIL PROTECTED] [mailto:nagios-users- > [EMAIL PROTECTED] On Behalf Of Mark Thompson > Sent: Wednesday, March 14, 2007 9:16 AM > To: nagios-users@lists.sourceforge.net > Subject: Re: [Nagios-users] running a perl script. > > The file was never on a win machine here. I opened the file with kwrite > and vi and don't see the ^M in the text. > They _are_ there or you wouldn't see the error. The problem is that it's not a printable character (carriage return) so kwrite and vi just aren't showing it. Try 'vi -b filename'. That will put vi in binary mode which will display everything in the file as a printable character (^M for [CTRL-M] in this case). vim, often used as a replacement for vi these days, seems to be better at automatically setting binary mode when necessary from my experience. -- Marc - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] running a perl script.
The file was never on a win machine here. I opened the file with kwrite and vi and don't see the ^M in the text. >>> "Marc Powell" <[EMAIL PROTECTED]> 03/14/07 8:04 AM >>> > -Original Message- > From: [EMAIL PROTECTED] [mailto:nagios-users- > [EMAIL PROTECTED] On Behalf Of Mark Thompson > Sent: Wednesday, March 14, 2007 8:54 AM > To: nagios-users@lists.sourceforge.net > Subject: [Nagios-users] running a perl script. > > Nagios 2.7 running on OpenSUSE 10.2 > Perl ver 5.8.8 > > I have the system up and running using the standard check plugins. I > downloaded some perl scripts from nagioexchange but don't seem to know how > to use them. I copied them into the libexec directory, changed the user > group, made them exe. When I try to run them from the command line I get > the error, > > Nagios1:/usr/local/nagios/libexec # ./check_gwia.pl -h > -bash: ./check_gwia.pl: /usr/bin/perl^M: bad interpreter: No such file or > directory > > Is it telling me it can't find perl? It's telling you it can't find the program /usr/bin/perl^M. That's different than /usr/bin/perl. Did you open this file on a Windows box and save it again? In wordpad perhaps? It has Windows specific formatting in it that's breaking the script. I'm going to bet that every line of the script ends in ^M. You'll need to remove them, either manually or using a vi search/replace like ':%s/[CTRL-V][CTRL-M]//'. -- Marc - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] running a perl script.
> -Original Message- > From: [EMAIL PROTECTED] [mailto:nagios-users- > [EMAIL PROTECTED] On Behalf Of Mark Thompson > Sent: Wednesday, March 14, 2007 8:54 AM > To: nagios-users@lists.sourceforge.net > Subject: [Nagios-users] running a perl script. > > Nagios 2.7 running on OpenSUSE 10.2 > Perl ver 5.8.8 > > I have the system up and running using the standard check plugins. I > downloaded some perl scripts from nagioexchange but don't seem to know how > to use them. I copied them into the libexec directory, changed the user > group, made them exe. When I try to run them from the command line I get > the error, > > Nagios1:/usr/local/nagios/libexec # ./check_gwia.pl -h > -bash: ./check_gwia.pl: /usr/bin/perl^M: bad interpreter: No such file or > directory > > Is it telling me it can't find perl? It's telling you it can't find the program /usr/bin/perl^M. That's different than /usr/bin/perl. Did you open this file on a Windows box and save it again? In wordpad perhaps? It has Windows specific formatting in it that's breaking the script. I'm going to bet that every line of the script ends in ^M. You'll need to remove them, either manually or using a vi search/replace like ':%s/[CTRL-V][CTRL-M]//'. -- Marc - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
[Nagios-users] running a perl script.
Nagios 2.7 running on OpenSUSE 10.2 Perl ver 5.8.8 I have the system up and running using the standard check plugins. I downloaded some perl scripts from nagioexchange but don't seem to know how to use them. I copied them into the libexec directory, changed the user group, made them exe. When I try to run them from the command line I get the error, Nagios1:/usr/local/nagios/libexec # ./check_gwia.pl -h -bash: ./check_gwia.pl: /usr/bin/perl^M: bad interpreter: No such file or directory Is it telling me it can't find perl? Nagios1:/usr/local/nagios/libexec # ls -l /usr/bin/perl -rwxr-xr-x 3 root root 1163988 Nov 25 05:43 /usr/bin/perl Do I need to do something else to these scripts? Can someone point me to some docs if its a complex problem, I will RTFM if I can find one. Thanks for any help. Mark Thompson, CNE6 Parsons State Hospital 2601 Gabriel Parsons, KS 67357 620 421 6550 x.3051 [EMAIL PROTECTED] 316 421 3623 fax - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null