Koozali.org: home of the SME Server
Legacy Forums => General Discussion (Legacy) => Topic started by: Morten U. Hansen 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
-
Just a guess, but it looks like you've got a stray space in there. Try this instead:
./create-mrtg server localhost
-
Hi Morten,
Did this solve the problem?
Rgds,
Jesper
-
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
-
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?
-
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
-
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.
-
Some Windows editors (such as "textpad"), will give you an option to save in a Unix format.
cheers
Brian
-
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
-
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