Log off specific users

From Michael's Information Zone
Revision as of 10:35, 6 March 2017 by Michael.mast (talk | contribs) (Created page with "<pre> for user in user1 user2 user3 ; do id=$(query user $user 2>> /dev/null | awk '{ print $3 }' | sed -e '/ID/ d') if [[ "$id" =~ ^[1-9][0-9]?$ ]]; then logoff $id echo date...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
for user in user1 user2 user3 ;
do
id=$(query user $user 2>> /dev/null | awk '{ print $3 }' | sed -e '/ID/ d')
if [[ "$id" =~ ^[1-9][0-9]?$ ]]; then
logoff $id
echo date "$user was logged off" >> logg_off.log
fi
done