- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Command not found error!
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 11:26 AM
04-05-2006 11:26 AM
Hi Guys,
I have an error message in hp server while running a korn shell script which has been working fine for many many years and hasn't been changed.
this script has acl permission bit set and someone has removed the acl permissions from it which makes sense why script not working anymore, however when I changed the permission and gave chmod 777 to this script it complains about a program file not found whick gets kicked off within that korn shell script, this program file does exist in the directory and always been there, below is the error message...
Error "/usr/local/bin/spool_menu.ksh[125]: realroot: not found"
I have checked the system PATH and /usr/local/bin is there, any ideas about the above error????
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 11:41 AM
04-05-2006 11:41 AM
SolutionIt is saying it can't find "realroot"
Try
which realroot
You might have to set the full path in the script instead...
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 11:41 AM
04-05-2006 11:41 AM
Re: Command not found error!
Perhaps the file is hidden from the user.
Check the permissoins on the program:
The error is on line 125. It may be misreportting another program that it calls.
Throw a set -x right after the shell statement in the script and you may get a better idea of what the problem is.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 11:45 AM
04-05-2006 11:45 AM
Re: Command not found error!
Make sure that the *directory* --'/usr/local/bin' -- is readable and executable by the user running the script that gives the error.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 12:10 PM
04-05-2006 12:10 PM
Re: Command not found error!
Hi Steven/Geoff,
Thanks for the quick responses guys, as this is a production problem, I had to get things going, so i have set the full path name of the command in the script which has got it working before I post this message, but this is not really resolving the problem and I want to find out the root cause as there are many other scripts in production which calls realroot and realroot program doesn't have the full path name in those scripts and obviously I don't want to manually set the full path name everywhere for realroot.
When I typed in which realroot, it gives me the full path name ie (/usr/local/bin/realroot)
I have reset the permissions on realroot (chmod 777 realroot)but when I run the script without the full path name it gives the same error ie (Error "/usr/local/bin/spool_menu.ksh[125]: realroot: not found")
Here is the error message when i put in set -x right below the shell statement in the script.
Enter a space separated list of ids to cancel, or (P) to select a printer
:- + read IDS
+ print Clear queue for printer - Please enter printer name : \c
Clear queue for printer - Please enter printer name : + read PRINTER
esd
+ [[ p = @(q|Q ]]
+ [[ esd = @(q|Q ]]
+ [[ -n esd ]]
+ realroot cancel esd -e
/usr/local/bin/spool_menu.ksh[126]: realroot:not found
+ print \n\nHit
Hit
end
Guys this script actually deletes jobs sitting on the printer queue...
Cheers
Raf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 12:14 PM
04-05-2006 12:14 PM
Re: Command not found error!
export PATH=$PATH:/usr/local/bin
to top of script?
BTW - I wouldn't have 777 on any script - 775 should be sufficient...
It also may be that the script needs to be setuid
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 12:22 PM
04-05-2006 12:22 PM
Re: Command not found error!
Just a note about PATH and scripts: Never use the PATH that the parent program (shell) uses. You have no control over it since any user (including root) can modify it, either on purpose or by accident. Instead, the first few lines in your script should have:
export PATH=/usr/bin:/usr/local/bin
This takes eefect only for the current script and disappears when the script terminates. If you need anotgher path, add it to your script.
Another note about which and whereis. Neither command is useful in scripting or debugging. You want to know exactly what the shell will do when a a text string is seen. The commands which and whereis will fail to locate "for" and "done", yet they are perfectly valid items in a script. You want to use whence, or better yet, whence -v. To make things easier, whence -v is aliased to type in ksh and POSIX-sh. So to see what the shell will find when you refer to realroot, use this command:
type realroot
You may be (unpleasantly) surprised to see that it has been aliased, something that which and whereis will never tell you.
And while you're at it, add set -u next to the PATH statement in your script. It prevents disastrous consequences due to spelling errors.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 12:28 PM
04-05-2006 12:28 PM
Re: Command not found error!
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 01:35 PM
04-05-2006 01:35 PM
Re: Command not found error!
Hi Team,
Thanks to everyone's prompt response and help, I have checked the permissions on /usr/local and /usr/local/bin directories and the user has access to it.
Bill and Geoff your suggestion worked as I have added the "export PATH=/usr/bin:/usr/local/bin" statement in script and its working like a charm, I have also added the path statement in user's .profile so it searches for the right directory as user's .profile kicks off the shell script and from the main menu user takes an option which kicks off this script which had problems.
I have changed the permissions to 777 temporarily just to test the script. I have now changed it back to 755..
Bill thanks for your detailed explanation, I have learned again something new today from our team. I will now assign points
Cheers,
Raf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 02:28 PM
04-05-2006 02:28 PM
Re: Command not found error!
Whenever you write any scripts, make sure you use absolute path or export PATH on top of the script to your special or custom commands. It is always a good practice. Just a thought i should share.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 06:47 PM
04-05-2006 06:47 PM
Re: Command not found error!
upper level directory permission for execution is needed to be check
If there are binaries with same name but in different location then PATH variable decides which one has to be executed. We have to be sure on that else,
OLDPATH=$PATH
PATH=...:..:..
..
..
export PATH=$OLDPATH
use this in your script.
PS: You've got the solution. Assing 0 points to this ;)
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2006 07:19 PM
04-05-2006 07:19 PM
Re: Command not found error!
Thanks as always Arun/Muthu for your input.....
As the problem has now been resolved but I'd love to give you a bottle of coke and a choclate along with the points:)....