admin scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

clubsocs_accounts_disable.sh 1.6 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. # -M flag means member will not be e-mailed their new account details.
  3. #Account Listings Clubs 102, Socs 101, dcu 31382, projects 1014, intersocs 1016
  4. clubs=$(ldapsearch -xLLL "(gidnumber=102)" | grep dn | awk -F = '{print $2}' | awk -F , '{print $1}')
  5. socs=$(ldapsearch -xLLL "(gidnumber=101)" | grep dn | awk -F = '{print $2}' | awk -F , '{print $1}')
  6. dcu=$(ldapsearch -xLLL "(gidnumber=31382)" | grep dn | awk -F = '{print $2}' | awk -F , '{print $1}')
  7. projects=$(ldapsearch -xLLL "(gidnumber=1014)" | grep dn | awk -F = '{print $2}' | awk -F , '{print $1}')
  8. intersocs=$(ldapsearch -xLLL "(gidnumber=1016)" | grep dn | awk -F = '{print $2}' | awk -F , '{print $1}')
  9. list=$(echo "$clubs\n$socs\n$dcu\n$projects\n$intersocs")
  10. msg=/srv/admin/scripts/accounts.d/message.txt
  11. #for user in $(ls /home/society)
  12. echo "You are about to disable all Impersonal RedBrick Accounts - To proceed type \"Proceed\", Print will show the accounts about to be diabled"
  13. read ans
  14. if [ "$ans" = "Proceed" ]; then
  15. for user in $list
  16. do
  17. useradm resetpw -M $user
  18. useradm setshell $user /usr/local/shells/disabled ]
  19. altmail=$(useradm show $user | grep altmail | awk '{print $2}')
  20. cat $msg | mutt -s "Your RedBrick Account" $user $altmail
  21. done
  22. elif [ "$ans" = "Print" ]; then
  23. for i in $list
  24. do
  25. echo $i
  26. done
  27. else
  28. echo Exiting
  29. exit
  30. fi
  31. #for user in `ls /home/club`
  32. #do
  33. # useradm resetpw -M $user
  34. # useradm setshell $user /usr/local/shells/disabled
  35. # altmail=$(useradm show $user | grep altmail | awk '{print $2}')
  36. # cat $msg | mutt -s "Your Club RedBrick Account" $user $altmail
  37. #done