- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: strange su behaviour
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
07-27-2005 03:47 AM
07-27-2005 03:47 AM
strange su behaviour
When starting a mc/SG Package several su - userid -c "Commands" are started.
They do not work, because they have a different environment as in an interactive su - userid.
This is especially true for the SHELL Variable.
The (wrong?!?!) behaviour could be simulated if su is started with input redirection from /dev/null like
su - userid -c "set ; env" >out #correct env
su - userid -c "set ; env" >out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 03:50 AM
07-27-2005 03:50 AM
Re: strange su behaviour
Looks like your "Commands" are written in a different shell language than what is set for the user by default. Most probably csh vs ksh conflict.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 04:00 AM
07-27-2005 04:00 AM
Re: strange su behaviour
1) Create a file (e.g. /usr/local/bin/userClay.sh) that sets and exports any needed environment variable but does not contain a return or exit command. Both user's .profile and your SG startup script should source this file using the shell "." (dot) operator
. /usr/local/bin/userClay.sh
This way both the profile and your startup script have the same environment.
2) Alter the .profile so that all those commands which expect stdin to be a tty device are surronded by
if [[ -t 0 ]]
then
tset ...
stty ...
tabs ...
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 04:00 AM
07-27-2005 04:00 AM
Re: strange su behaviour
Can you post the error messages from the package log here so we can see the errors.
Also, can you post the package script or at least the part that has the su - calls in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 04:24 AM
07-27-2005 04:24 AM
Re: strange su behaviour
In BOTH cases I USE su - userid, so it should be the same.
su - userid -c "set;env" >out gives (shortend)
ENV=/home/userid/.kshrc
OS=HP-UX
OS_VERSION=B.11.00
SHELL=/bin/ksh
SHLIB_PATH=''
su - userid -c "set ; env" >out /dev/null gives:
EDITOR=vi
ENV=/home/userid/.shrc
OS=HP-UX
OS_VERSION=B.11.00
SHELL=/sbin/sh
SHLIB_PATH=''
Funny, isn't it !
Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 04:49 AM
07-27-2005 04:49 AM
Re: strange su behaviour
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 04:58 AM
07-27-2005 04:58 AM
Re: strange su behaviour
The /dev/null causes an error:
stty: not a typewriter
This is a known issue in ServiceGuard (and other applications doing this type of scripting) with su and the workaround is documented in :
UMCSGKBRC00012842
You can look it up in the maintanence database (I'd link it, but I only have the US link address not the European one).
Best regards,
Kent M. Ostby
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 04:58 AM
07-27-2005 04:58 AM
Re: strange su behaviour
can I suggest temporarily moving the /etc/profile and ~userid/.profile out of the way for a few seconds and run these commands without them getting in the way ? Looks like something in one of those is offending your login sequence.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2005 05:03 AM
07-27-2005 05:03 AM