Deleted Added
full compact
rmuser.sh (107543) rmuser.sh (107694)
1#!/bin/sh
2#
3# Copyright (c) 2002 Michael Telahun Makonnen. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Email: Mike Makonnen <mtm@identd.net>
28#
1#!/bin/sh
2#
3# Copyright (c) 2002 Michael Telahun Makonnen. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Email: Mike Makonnen <mtm@identd.net>
28#
29# $FreeBSD: head/usr.sbin/adduser/rmuser.sh 107543 2002-12-03 05:41:09Z scottl $
29# $FreeBSD: head/usr.sbin/adduser/rmuser.sh 107694 2002-12-09 02:22:50Z tjr $
30#
31
32ATJOBDIR="/var/at/jobs"
33CRONJOBDIR="/var/cron/tabs"
34MAILSPOOL="/var/mail"
35SIGKILL="-KILL"
30#
31
32ATJOBDIR="/var/at/jobs"
33CRONJOBDIR="/var/cron/tabs"
34MAILSPOOL="/var/mail"
35SIGKILL="-KILL"
36TEMPDIRS="/tmp /var/tmp /var/tmp/vi.recover"
36TEMPDIRS="/tmp /var/tmp"
37THISCMD=`/usr/bin/basename $0`
38
39# err msg
40# Display $msg on stderr.
41#
42err() {
43 echo 1>&2 ${THISCMD}: $*
44}

--- 7 unchanged lines hidden (view full) ---

52 [ -n $1 ] && login=$1 || return
53
54 for _dir in ${TEMPDIRS} ; do
55 if [ ! -d $_dir ]; then
56 err "$_dir is not a valid directory."
57 continue
58 fi
59 echo -n "Removing files owned by ($login) in $_dir:"
37THISCMD=`/usr/bin/basename $0`
38
39# err msg
40# Display $msg on stderr.
41#
42err() {
43 echo 1>&2 ${THISCMD}: $*
44}

--- 7 unchanged lines hidden (view full) ---

52 [ -n $1 ] && login=$1 || return
53
54 for _dir in ${TEMPDIRS} ; do
55 if [ ! -d $_dir ]; then
56 err "$_dir is not a valid directory."
57 continue
58 fi
59 echo -n "Removing files owned by ($login) in $_dir:"
60 filecount=0
61 _ownedfiles=`find 2>/dev/null $_dir -maxdepth 1 -user $login -print`
62 for _file in $_ownedfiles ; do
63 rm -fd $_file
64 filecount=`expr $filecount + 1`
65 done
60 filecount=`find 2>/dev/null "$_dir" -user "$login" -delete -print | \
61 wc -l | sed 's/ *//'`
66 echo " $filecount removed."
67 done
68}
69
70# rm_mail login
71# Removes unix mail and pop daemon files belonging to the user
72# specified in the $login argument.
73#

--- 252 unchanged lines hidden ---
62 echo " $filecount removed."
63 done
64}
65
66# rm_mail login
67# Removes unix mail and pop daemon files belonging to the user
68# specified in the $login argument.
69#

--- 252 unchanged lines hidden ---