- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: "su -" hangs when called inside a shell script...
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
08-31-2005 02:24 AM
08-31-2005 02:24 AM
"su -" hangs when called inside a shell script.
su -
Periodically when the master script calls the sub script, the "su" will hang. You can see the "su" in a ps, but it is not running.
We can kill the "su", rerun the master script and the "su" from the sub script runs fine.
Any thoughts or suggestions would be greatly appreciated.
Thanks!
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 02:28 AM
08-31-2005 02:28 AM
Re: "su -" hangs when called inside a shell script.
su -
Does it work?? If not resolve it and if everything is ok, move on. Run the script.
"<script> $ARGS" Is that OK??
If not check your script.
Put set -vx in script and check what step it failes at. Make sure you run commands with full path names, all required variables are defined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 02:29 AM
08-31-2005 02:29 AM
Re: "su -" hangs when called inside a shell script.
Who's running the script? Root?
If it's not root, su will wait for a password.
Enjoy :)
Pedro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 02:29 AM
08-31-2005 02:29 AM
Re: "su -" hangs when called inside a shell script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 02:31 AM
08-31-2005 02:31 AM
Re: "su -" hangs when called inside a shell script.
Unless the script issuing the 'su' is running as 'root', 'su' will prompt for a password for the account to which you are attmpting to switch. The problem is that you cannot supply the password except in an interactive way; i.e. redirection from file will not work.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 03:04 AM
08-31-2005 03:04 AM
Re: "su -" hangs when called inside a shell script.
1) It is being run by root.
2) The su command runs by hand works fine.
3) The su itself appears to hang, we never receive the login banner from the "su -".
Thanks!
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 03:53 AM
08-31-2005 03:53 AM
Re: "su -" hangs when called inside a shell script.
I think that some environment variable is missing.
Are you running this script from cron?
If you run it from cron you don't have the environement variables defined of the user root and they are not passed to the user when you su to it.
Check:
#man su
#man cron
Enjoy :)
Pedro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 07:28 AM
08-31-2005 07:28 AM
Re: "su -" hangs when called inside a shell script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 07:44 AM
08-31-2005 07:44 AM
Re: "su -" hangs when called inside a shell script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2005 08:33 AM
08-31-2005 08:33 AM
Re: "su -" hangs when called inside a shell script.
set -x
and right after su line, insert another one containing, guess what:
set +x
and run your script. You may see why and where it stops. If you see the su command getting executed, then try starting your script called from the su command with "set -x" and ending it with "set +x", it will show you the variable assignments made on the fly or what it is waiting for etc.
hope this helps
UNIX because I majored in cryptology...