nethserver-profilemgr/root/etc/e-smith/events/actions/profile-clean

33 lines
723 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/perl -w
package esmith;
use strict;
use Errno;
use esmith::DB::db;
use IO::File;
use English;
# This scripts helps out cleaning the whole profile (data and settings) for a
# single user using LDAP/SAMBA.
my $db_users = esmith::DB::db->open('accounts') || die("Cannot open e-smith db accounts: " . esmith::DB::db->error . "\n");
my $event = $ARGV[0];
defined $ARGV[1] || die("No user specified");
my $user = $ARGV[1];
profile_clean($user);
sub profile_clean {
my ($username) = @_;
my @u = $db_users->get($username) || die("No user record for '$username'.");
system("find /var/lib/nethserver/home/$username -delete") == 0 || die("Error cleaning up profile for $username. Exiting.");
}