Wednesday, March 3, 2010 at 1:32 pm
Solaris/bash: “no: command not found”
At work we have a script, that rsyncs a bunch of files from one server to the other, nothing special. The script works perfectly when run manually from a shell, but does not when run via crontab. The error message does not really point to anything:
no: command not found
What is the “no” command and why and who tries to call it!?
Well, what happened was: I though I was being clever and used RSYNC=$(which rsync) to find the rsync command to execute. Unfortunately rsync actually is located in /usr/local/bin on this system and /usr/local/bin is not in the PATH, so which could not find it. Running the script from a shell worked, because that user just happened to have /usr/local/bin appended to it’s PATH environment variable. The “no” comes from the message which returns when it cannot find the command:
no rsync in /usr/bin /sbin /usr/sbin /bin /usr/bin

