scripts and tools to administer the lingy.in public unix / tilde
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.

33 lines
461B

  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. my $fn;
  5. my $cmd_out;
  6. my $dn;
  7. my @hd;
  8. $dn = "/home/";
  9. opendir MYDIR, $dn or die "could not open $dn";
  10. @hd = readdir MYDIR;
  11. closedir MYDIR;
  12. @hd = grep {!($_ =~ /^\..*$/)} @hd;
  13. $fn = "/tilde/lyadmin/user_list.txt";
  14. open FILE, "<", $fn or die "could not open $fn";
  15. while(<FILE>){
  16. chomp;
  17. unless(exists( {map { $_ => 1} @hd}->{$_})){
  18. printf("Deleting user %s\n", $_);
  19. `userdel $_`;
  20. }
  21. }
  22. close FILE