I hit _send_ to quickly... The simple script that I proposed suffers from the problem that it would kill one of your own processes if you are the offending user, ont one of your students; likewise, it would blithely kill a system process, or an essential cronjob, or a server.
You can modify the 'smem' command to use its 'user filter' option (see the man page) to come up with a regex to limit its output to just those users whose processes you are comfortable killing. The regex can be as simple as (user1)|(user2)|...|(usern) ; I don't see how to use UID numbers, but it might be possible. smem -U "$YOUR_REGEX" -c pid | tail -n1 On 2018-11-11 10:16, Boruch Baum wrote: > NAUGHTY="$(smem -c pid | tail -n1)" smem -U "$YOUR_REGEX" -c pid if [ -z "$NAUGHTY" ] ; then printf "The guilty party isn't one of the students... its $(smem |tail -n1)\n" exit fi > for SIG in 15 15 15 9 9 > do > kill -$SIG $NAUGHTY > printf "Sending signal $SIG to process $NAUGHTY\n" > sleep 1 > ps -$naughty || exit > printf "Process $NAUGHTY is Still alive\n" > done > > > [1] https://www.selenic.com/smem/ > [2] https://en.wikipedia.org/wiki/Proportional_set_size -- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 _______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il