HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scritp to Kill process
Operating System - HP-UX
1834162
Members
2444
Online
110064
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
12-27-2003 04:53 AM
12-27-2003 04:53 AM
Hello all, I need a scritp to kill process with some accounts because I don't want they know the root password, maybe only run a script and they put the account and the script kill the process
Thanks
Thanks
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2003 09:54 AM
12-27-2003 09:54 AM
Re: Scritp to Kill process
A script to kill all processes owned by a specific user may be abit risky, especially if you kill processes that depend on each other or processes that will corrupt data files unless they are allowed to terminate correctly. The steps are fairly simple as far as a script to kill the processes. Use ps -u user_name to find all the processes and awk to extract the PID's (if any). Of course, never allow root as the user ID or a user ID = 0. (ps -u accepts either a name or an ID number). Also, your script will crash the system if your password file has duplicate root users (multiple users with UID=0). Note that this is never a good idea anyway.
The majority of the script must be devoted to not making a mistake. The script must check for a non-eistant user, it must check that the user does not have UID=0, and it should not allow 'system' UID's such as lp, www, ids, ftp and so on. Once you've validated the user ID, then loop through the PID's and kill them with kill -15. Don't start with kill -9 as it can corrupt data files. Processes that can't be terminated with kill -15 need examination for problems and poor coding.
Finally, the script should runnable only by root. Use chmod 700. Then download a copy of sudo and edit the sudoers file to allow only certain users to run the script.
Bill Hassell, sysadmin
The majority of the script must be devoted to not making a mistake. The script must check for a non-eistant user, it must check that the user does not have UID=0, and it should not allow 'system' UID's such as lp, www, ids, ftp and so on. Once you've validated the user ID, then loop through the PID's and kill them with kill -15. Don't start with kill -9 as it can corrupt data files. Processes that can't be terminated with kill -15 need examination for problems and poor coding.
Finally, the script should runnable only by root. Use chmod 700. Then download a copy of sudo and edit the sudoers file to allow only certain users to run the script.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2003 11:21 AM
12-27-2003 11:21 AM
Solution
I am attaching a script, copied from a book that can kill a process or processes based on any input string. Its got safeguards for root processes but is still an extremely powerful and therefor dangerous script.
Use it carefully and at your own risk.
SEP
Use it carefully and at your own risk.
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP