Koozali.org: home of the SME Server

Cannot execute script!!

Morten U. Hansen

Cannot execute script!!
« on: May 06, 2003, 02:23:46 AM »
I have problems with the simplest script. It seems I cannot run the script create-mrtg mentioned in this How-To:
http://sme.swerts-knudsen.dk/howtos/howto_6.htm

The script (active lines) looks like this:
****
#!/bin/bash
mkdir -p /home/e-smith/files/ibays/mrtg/html/$1
perl /usr/bin/cfgmaker public@$2 --global "workdir: /home/e-smith/files/ibays/mrtg/html/$1" --output /etc/mrtg/$1.cfg
perl /usr/bin/indexmaker /etc/mrtg/$1.cfg > /home/e-smith/files/ibays/mrtg/html/$1/index.html
echo "/usr/bin/mrtg /etc/mrtg/$1.cfg;" >> /etc/mrtg/all-ip
****
And I execute with this command: "./ create-mrtg server localhost
I get this error: bash: ./ is a directory

How do I get on with this How-To?

Earlier today I made another script starting with :  "#!/bin/bash" and run this flawlessly.

Thanks for any input

Morten

Dan Brown

Re: Cannot execute script!!
« Reply #1 on: May 06, 2003, 02:43:13 AM »
Just a guess, but it looks like you've got a stray space in there.  Try this instead:

./create-mrtg server localhost

Jesper Knudsen

Re: Cannot execute script!!
« Reply #2 on: May 06, 2003, 02:45:18 PM »
Hi Morten,

Did this solve the problem?

Rgds,
Jesper

Morten U. Hansen

Re: Cannot execute script!!
« Reply #3 on: May 07, 2003, 12:22:11 AM »
Thanks Dan,

But still same problem:

[root@indsigt1 root]# ls
anaconda-ks.cfg  create  create-mrtg  install.log  install.log.syslog
[root@indsigt1 root]# ./create-mrtg server localhost
: bad interpreter: No such file or directory
[root@indsigt1 root]#

So no change even though I had put a space in there...

Hmm

Any other ideas?

Morten

Dan Brown

Re: Cannot execute script!!
« Reply #4 on: May 07, 2003, 12:46:43 AM »
No, there was a change--it still doesn't work, but it's doing something different.  Had you possibly edited this file on a windows machine before putting it on your SME box?

Morten U. Hansen

Re: Cannot execute script!!
« Reply #5 on: May 07, 2003, 02:35:32 AM »
Yes! - might this be the problem?

I find it easier to paste the scripts into a win-editor before putting it on the SME-server.

Is this a no-do...?

thnx

Morten

Dan Brown

Re: Cannot execute script!!
« Reply #6 on: May 07, 2003, 02:50:04 AM »
Yes, this is almost certainly the problem.  Windows uses a different line terminator than Linux (and other *nix OSs), which will make the file more or less unusable on the *nix system.

Brian Read

Re: Cannot execute script!!
« Reply #7 on: May 07, 2003, 10:49:07 AM »
Some Windows editors (such as "textpad"), will give you an option to save in a Unix format.

cheers

Brian

Morten U. Hansen

Re: Cannot execute script!!
« Reply #8 on: May 07, 2003, 12:16:44 PM »
That's it!

I use an advanced hex/text editor named UltraEdit32, which can convert files to *nix format. And now it works.

I created the script ran it and it did all sorts of things. So now I have the *cfg file + the index file in the mrtg/server dir...

I think I'm getting there.

Thanks guys for your help.

Morten

Offline judgej

  • *
  • 375
  • +0/-0
Re: Cannot execute script!!
« Reply #9 on: January 28, 2006, 06:54:52 PM »
Been tearing my hair out for hours trying to install mnogosearch, getting that bad interpreter error, and just could not see what was wrong. The problem is that vim/vi does not show the extra CR characters on the end of each line, so I did not even suspect the line endings.

Thanks for this thread guys :-)

-- JJ
-- Jason