Operating System - HP-UX
1851077 Members
2351 Online
104056 Solutions
New Discussion

Re: paths and permissions

 
Angela Swyers_1
Frequent Advisor

paths and permissions

I am moving an application to a new server. We had a bunch of shell scripts that were in the /usr/bin directory. I would like to keep all of these is a custom directory so that when I'm moving stuff to another server I don't have to go looking for them. I have this new directory in my users path and they have full rights to use it. Yet, when I try to run this program it can't find it. Any ideas?
10 REPLIES 10
Steven E. Protter
Exalted Contributor

Re: paths and permissions

We use /usr/contrib/bin

You will need to add that to user path in .profile or /etc/profile

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: paths and permissions

Hi,

I would first check the PATH before running the command.

$echo $PATH

Make sure the directory appears in path. Then ensure they could be able to actually do a listing of it

$ll /usr/custom/bin/command

I called it as /usr/custom/bin.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Abdul Rahiman
Esteemed Contributor

Re: paths and permissions

Try running whence or which against your script to see if it's finding the script.

eg: # whence myscript.sh

If it doens't find it there may be issues with the $PATH variable.
No unix, no fun
Angela Swyers_1
Frequent Advisor

Re: paths and permissions

whence finds it but whereis doesn't?
Patrick Wallek
Honored Contributor

Re: paths and permissions

What error do you get when you try to run these scripts? Are the permissions on the scripts themselves correct?
Jeroen Peereboom
Honored Contributor

Re: paths and permissions

Angela,

- login as the user
A start the program by typing its full name (with leading /)
B start the program by typing just its name

A: should work.
B: What is the error message?

Do an 'echo $PATH' and check that you didn't make a typo (colon / semicolon).

If you want the directory in $PATH for all users, you can add it to the file /etc/PATH.

Do the old server and new server have the same OS? If not, is the first line of the scripts pointing to a correct shell?

JP.
Abdul Rahiman
Esteemed Contributor

Re: paths and permissions

How about the permission of the new directory itself ?
Is it 755 or not ?

If not change it to 755 and see if the program runs or not with the script anme.
No unix, no fun
Angela Swyers_1
Frequent Advisor

Re: paths and permissions

It is 755. If I make a logical link to /usr/bin it seems to work just fine. This script is called from another so there must be something that is replacing the PATH in some way.
Jeroen Peereboom
Honored Contributor

Re: paths and permissions

Angela,
you must check the calling script. Maybe the PATH is changed within the calling script, or the script is called with its full name?

JP
Abdul Rahiman
Esteemed Contributor

Re: paths and permissions

Well, if the script is called from some other script, you may want to make sure that those scripts don't modify your PATH.
Insert a echo $PATH command just in front of the script name in the other script and see what it tells you.

Just as a side note, if the script is called by another script or via cron, you must set the PATH separately or add it to the existing PATH variable.

export PATH=${PATH}:/your/newdir

HTH,
Abdul.
No unix, no fun