Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
check for user running a program before updating and skip them if they are
#!/bin/bash
#
# Proof of concept
# check for user running a program before updating and skip them if they are
#
PROGRAM="irssi"
# Check ps for users running a process name & compare against list of non-admin users
#
upgradable_users=`comm -13 <(ps -C $PROGRAM -o fuser |grep -v USER|sort|uniq) <(awk -F: '$3 > 500 {print $1}' /etc/passwd|sort)`
for cur_user in $upgradable_users
do
#echo "fixing $cur_user 's problems with $PROGRAM"
ls -ld /home/"$cur_user"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment