#!/usr/bin/perl -w

#------------------------------------------------------------
#This action deletes the home directory for an existing user
#
#Command format:
#
# user-delete-home event username
#
#  event    : calling event name
#  username : username that exists in AD
#
#Copyright 2016 Koozali Foundation, Inc.
#09/24/2016: G.Zartman <gzartman@koozali.org>
#
#The code contained herein can be distributed under the same
#license as Perl
#------------------------------------------------------------
package esmith::thisaction;

use strict;
use warnings;
use File::Path qw( rmtree );

#Pull arguments
my $event       = $ARGV [0] || '';
my $userName    = $ARGV [1] || '';

die "Username not found in action arguments.\n"
  unless ($userName);

rmtree ('/home/e-smith/files/users/' . $userName);

exit(0); 
