This commit is contained in:
Peter Hormanns 2011-10-28 10:24:24 +00:00
parent e280c2a192
commit 70633fc2c5

View File

@ -56,13 +56,14 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory {
UnixUser user = (UnixUser) entity;
String uid = user.getName();
if (uid != null && uid.length() > 4) {
Processor killProcessesProc = new ShellProcessor("killall -u " + uid);
Processor userdelProc = null;
if (user.isDefaultHomedir()) {
userdelProc = new ShellProcessor("userdel " + uid + " && rm -rf '" + user.getHomedir() + "'");
} else {
userdelProc = new ShellProcessor("userdel " + uid);
}
CompoundProcessor proc = new CompoundProcessor(userdelProc);
CompoundProcessor proc = new CompoundProcessor(killProcessesProc, userdelProc);
proc.appendProcessor(new ShellProcessor("rm -f '/var/spool/cron/crontabs/" + uid + "'"));
proc.appendProcessor(new ShellProcessor("rm -f '/var/mail/" + uid + "'"));
return proc;