Koozali.org: home of the SME Server

bash: [command]: command not found

Jim Hale

bash: [command]: command not found
« on: September 26, 2002, 05:09:53 AM »
Maybe if I ask it a different way -

Why would SME bash stop running programs from a Secure Shell prompt? It doesn't matter what the name of the script is, I get the same error over and over. It worked 2 days ago, the script is listed as 'X', but now it doesn't work.

Thanks for any points in the right direction. :)

Scott Smith

Re: bash: [command]: command not found
« Reply #1 on: September 26, 2002, 06:36:21 AM »
Have you updated the scripts recently, perhaps uploading them from a non-*nix workstation? If your script now has the DOS/Win end-of-line CR/LF, instead of the *nix LF, you'll get this message.

Try this:

# sed 's/.$//' script > newscript

If you then vi newscript and are not missing the last characters from lines, this was your problem. The newscript will probably exec.

Be aware that you may get this error if just SOME of the lines have the CR/LF EOL. The above is not a 100% reliable way to fix the problem, just a quick and dirty check and can be destructive if no all lines are using CR/LF. Search the forums for other ways to harmlessly convert files from DOS/Win to *nix format.

Jim Hale

Re: bash: [command]: command not found
« Reply #2 on: September 26, 2002, 06:49:23 AM »
Thanks for replying :)

But that didn't work either. :/ I've even gone all the way to completely re-writing the script using vi thru the secure shell and it still comes back with the same error - this is REALLY driving me nuts as I don't have a Tape Drive on that machine. :/

Any other points to look for would be great!

Thanks Scott :)

Dan Brown

Re: bash: [command]: command not found
« Reply #3 on: September 26, 2002, 07:11:19 AM »
Are you logged in as root?  If so, does ./X work?

Jim Hale

Re: bash: [command]: command not found
« Reply #4 on: September 26, 2002, 07:22:15 AM »
I *am* logged in as root but you'll have to excuse my ignorance on ./X. I tried typing that in and got 'bash: ./X: no such file or directory'.

What does it do? :/

Dan Brown

Re: bash: [command]: command not found
« Reply #5 on: September 26, 2002, 07:32:43 AM »
When you're logged in as root, by default . (the current directory) is _not_ included in $PATH for security reasons.  If you want to run a program that is in the current directory (which is not in $PATH), you'd type ./programname.

Other possibilities are permissions and malformed scripts (do they start with #!/bin/sh ?)

To answer your initial question, there's nothing inherent about being logged in through SSH that would make a difference.

Jim Hale

Re: bash: [command]: command not found
« Reply #6 on: September 26, 2002, 07:53:20 AM »
BINGO!

I shoulda known that. It now works from the shell, but what would I need to put in so that the CRON job I setup Sunday will run it?

I currently have:

0 23 * * * /home/e-smith/files/ibays/backup/files/backup

Where the last 'backup' is the script itself.

Thanks!

Dan Brown

Re: bash: [command]: command not found
« Reply #7 on: September 26, 2002, 08:02:43 AM »
Well, what did you do that worked?

Jim Hale

Re: bash: [command]: command not found
« Reply #8 on: September 26, 2002, 08:07:45 AM »
I manually changed into the /home/e-smith/files/ibays/backup/files folder and ran ./backup. That did just what I needed it to.

How would I input that into the CRON job?

Dan Brown

Re: bash: [command]: command not found
« Reply #9 on: September 26, 2002, 08:11:03 AM »
If that was the only thing you changed, the crontab should work, as it explicitly specifies the absolute path to the script.

Jon Blakely

Re: bash: [command]: command not found
« Reply #10 on: September 26, 2002, 08:29:04 AM »
Where have you put the crontab. If it is in /etc/crontab it will need to have a user i.e

0 23 * * * root /home/e-smith/files/ibays/backup/files/backup

Jon

Jim Hale

Re: bash: [command]: command not found
« Reply #11 on: September 26, 2002, 08:30:00 AM »
I went ahead and just typed the line that the CRON executes (from a totally different folder) and it still worked. I have the event set for 11pm every night so I'll know in the morning when I check the Tape.

Thanks Dan and Scott! :)