- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: interrupting a script run as root
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
Discussions
Discussions
Forums
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
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-07-2002 01:27 AM
тАО02-07-2002 01:27 AM
interrupting a script run as root
Thanks
Federico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2002 01:31 AM
тАО02-07-2002 01:31 AM
Re: interrupting a script run as root
Just be careful not to allow others write permission on the script!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2002 01:54 AM
тАО02-07-2002 01:54 AM
Re: interrupting a script run as root
I use restricted SAM for such purposes. Easy menu-system for the user, let them execute with root privileges for restricted commands.
# sam -r
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2002 07:33 AM
тАО02-07-2002 07:33 AM
Re: interrupting a script run as root
I believe that when the user breaks out of the script, he will be returned to his shell, not root's. However, it is good practice to use the trap statement in your shell scripts. For example:
trap "" 2
This tells the script to ignore signal 2, the interrupt or break signal. The effect is you can't break out of the script with CTRL-C.
man 1 kill for the most commonly used signals. kill -l (lowercase letter l) lists all signals. man sh-posix (or the other shells) for more info.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2002 05:18 PM
тАО02-07-2002 05:18 PM
Re: interrupting a script run as root
For now, prevent interrupting the shell script the same way as /etc/profile does it:
trap "" 1 2 3
Make this the first statement after your shell script loader (ie, first line must be #!/usr/bin/sh). Note: every shell script should start with #!/usr/bin/shell_name
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2002 11:43 PM
тАО02-07-2002 11:43 PM
Re: interrupting a script run as root
start the last command with "exec" - if that is aborted somehow, there will be no shell "left"...
Just my $0.02,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-08-2002 01:27 AM
тАО02-08-2002 01:27 AM
Re: interrupting a script run as root
Share and Enjoy! Ian