- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Menu script with inactivity timer ?
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-16-2004 10:49 PM
02-16-2004 10:49 PM
What I'm looking for is a simple way to exit the script after xx minutes of inactivity.
I was thinking about the TMOUT variable in posix shell, but since the script never returns to the prompt (read my_command) this don't help.
Any idea's on how to do this ?
Haakon
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 11:08 PM
02-16-2004 11:08 PM
Re: Menu script with inactivity timer ?
Start a "sleep" in the background which is set to kill the menu script. If a menu option is selected, kill the sleep. Something like this
#all your menu code goes here
( sleep 10; kill $$)& # kill my menu script
# get an option
kill $! # kill last job run in the background
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 11:10 PM
02-16-2004 11:10 PM
Re: Menu script with inactivity timer ?
try do do something with uptime or w command to estimate idle time.
Borislav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 11:26 PM
02-16-2004 11:26 PM
Solutionmy_command=`line -t
to read a line from input.
So if your menu is usually waiting for the next command to execute, you may use this command wirh a timeout, in which case my_command is empty.
Check the manpage for portability issues.
I don't know how to distinguish a timeout from a simple
JP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2004 11:46 PM
02-16-2004 11:46 PM
Re: Menu script with inactivity timer ?
Jeroen is quite correct with
my_command==`line -t
test like this
my_command=`line -t 3`
if [ -z "$my_command" ]
then
my_command=exit
fi
echo $my_command
Steve Steel