- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- to exit a 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
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-13-2001 07:30 AM
02-13-2001 07:30 AM
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 07:32 AM
02-13-2001 07:32 AM
Re: to exit a script..
The seemed to work unless they did a Cntrl-C
to break out of a running app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 07:39 AM
02-13-2001 07:39 AM
Re: to exit a script..
You could use
trap "exit 0" INT QUIT ABRT KILL
instead of trap "echo... " 2
Regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 07:41 AM
02-13-2001 07:41 AM
SolutionIn the $HOME/.profile at the end, do:
exec
When the user exit's your script, they will be logged off. When the user you have created for this purpose logs on, your script will automatically be run. For added protection, at the beginning of the profile, add the following:
trap "" 1 2 3
This will keep the smart user from breaking into a shell as the profile is sourced during the login.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 07:45 AM
02-13-2001 07:45 AM
Re: to exit a script..
and do cntrl-c to break out it give me a command line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 07:56 AM
02-13-2001 07:56 AM
Re: to exit a script..
Near the beginning of your script, you could "undefine" the interrupt using:
stty intr ^-
Don't forget to undefine susp and dsusp as well, otherwise job control will still be possible.
Regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 08:00 AM
02-13-2001 08:00 AM
Re: to exit a script..
what about putting the script into passwd as the login(shell) ?
BTW: You use 'more' in your script to view mail.log and if more stops for next page the user could get a shell prompt with !
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 09:13 AM
02-13-2001 09:13 AM
Re: to exit a script..
I was wondering if you could tell me why that works?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 09:46 AM
02-13-2001 09:46 AM
Re: to exit a script..
'exec
When you exit that exec'ed process, there is nothing to which to return.
The 'trap' command catches the interrupts (signals) we want to handle. As coded, it does nothing, so it serves as a "no-op" to the user, defeating his/her use of the keyboard interrupts during login and for the exec'ed script.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2001 11:44 AM
02-13-2001 11:44 AM
Re: to exit a script..
BTW : The point that Andreas makes is a very good one! [and you should credit him generously with points!!!]. In the mechanism I presented, it is possible when you use commands like 'more' and 'elm', to invoke a shell from them. As Andreas suggests, an alternative is to replace the usual shell declaration, in the /etc/passwd entry for the user in question, with the name of your script. Then, if the script invokes 'more', for instance, to invoke a shell, the user will be rewarded merely with yet another instantiation of your script! Once your script is exited, the user will be logged off with either this mechanism, or the one I suggestsed originally.
Regards!
...JRF...