Not a long time ago we found out about pkill
and we had in mind to start using it in a setuid (for root) script for global clean-up of processes. This could save us lots of stupid maintenance where some clients can´t remove general resources using their scripts only due not important permission limitations.
However, after some struggling we only came up with pkill -v -u root <name>
(so far we intent to make it simple and prevent from devolving into a long and ugly script with sed
,awk
,grep
and so on). Of course it doesn´t work — it just kills everything but the processes that match the given name.
Is there a any short modified version of that pkill
command that get us the results we need?
P.S: I want to avoid any discussions about the morality of giving some sort of root power to the users.
The running OS is solaris 10, if that matters.