- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Weird bash behavior
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
02-15-2008 05:05 AM
02-15-2008 05:05 AM
# bash --version
GNU bash, version 3.00.0(3)-release (hppa2.0w-hp-hpux11.11)
Copyright (C) 2004 Free Software Foundation, Inc.
If a user do not exit this simple menu, and shuts down his PC, or other reason and do not log off.. I see bash hitting the CPU hard, and creating some
Is this normal? If in one night, I have two of three bash session behaving this way, it has a big impact on our machines, hitting our CPU hard..
Any input on this?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2008 05:47 AM
02-15-2008 05:47 AM
Re: Weird bash behavior
bash for HP-UX is not exactly mainstream software. You may wish to migrate those uses that can tolerate it to korn shell or posix.
Or look for a newer version of bash. I've not seen this, however most of my users that use bash use it while connected to a Linux server, not an HP-UX server.
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
02-15-2008 06:03 AM
02-15-2008 06:03 AM
Re: Weird bash behavior
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2008 07:54 PM
02-15-2008 07:54 PM
SolutionHere are the two traps:
trap "" 1 2 3 15
trap 1 2 3 15
The first trap disables signals 1,2,3 and 15. The "" is a do-nothing action and the numbers are signals. For instance, a CTRL-C generates a signal 15 and it will do nothing after this trap is run.
The second trap restores normal operation and CTRL-C now terminates the current process. The hang occurs when signal 1 (also known as SIGHUP or hangup) is disabled. A session, whether connected by a LAN or a modem will generate a SIGHUP signal it the connection is severed (as in hang up the telephone).
So when a connection is terminated by a PC crash, the hangup signal will terminate the process tree for that terminal -- unless SIGHUP is disabled. When a session is disconnected but the processes are still attached if the hangup signal does not occur. This creates an indeterminate state and the shell starts talking to itself. Thus the excess CPU usage. Defunct processes can occur when child processes do not get become orphans due to parent problems.
So in your script, whether it is run from /etc/profile or is the actual shell for the user, be sure trap 1 is run at the start of the script. You will probably want to disable 2,3 and 15 so something like this at the start:
trap 1
trap "" 2 3 15
As far as a timeout goes, this gets a bit trickier. It's not practical to change every input line in the script, so you may need to write a parent script to watch the activity on the line. The who -u command will show the idle time for the current session. You'll need to evaluate an appropriate idle time (minutes, hours) and then terminate the menu program.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2008 04:23 AM
02-16-2008 04:23 AM
Re: Weird bash behavior
Since you are still in the profile and are concerned with users terminating the session unexpectedly you may want to try adding the following at the top of the profile
trap exit 1 2 3 15
Then should an event occur the script should exit (terminate).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2008 06:59 AM
02-18-2008 06:59 AM
Re: Weird bash behavior
my profile is set up correctly.. But I did some debuging, and on BASH.. the command "trap 1 2 3" does not work.. It works on posix tho..
Look...Running on posix
# trap 1 2 3
# trap
trap -- 'echo '\''logout root'\' EXIT
Running on bash
# /usr/local/bin/bash
# trap 1 2 3
# trap
trap -- '1' SIGINT
trap -- '1' SIGQUIT
It mapped 1 to SIGINT and SIGQUIT...
I'll fix this and should fix our problems..
Thanks!!