Mi pare ottimo il tuo script... per non applicare la regola all'user root è corretta la modifica che ho riportato?#!/bin/bash
if [ "$#" -ne 1 ]
then
echo "usage: $0 <process_name>"
exit 1
fi
user_list=`cat /etc/shadow | cut -d ":" -f 1`
for user_name in $user_list; do
lines=`ps -U $user_name | awk /"$1"$/'{print $1}' | wc -l | cut -d " " -f 1`
if ![ "$user_name" = "root" ]
then
if [ "$lines" -gt 1 ]
then
kill `ps -U $user_name | awk /"$1"$/'{print $1}' | head -$(($lines-1))`
fi
fi
done
exit 0
![]()