[Pkg-shadow-devel] Should userdel remove users crontabs?
Tomasz Kłoczko
kloczek@zie.pg.gda.pl
Tue, 24 May 2005 20:29:25 +0200 (CEST)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--568760595-2049476239-1116959365=:27760
Content-Type: TEXT/PLAIN; charset=UTF-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
On Tue, 24 May 2005, Christian Perrier wrote:
> (Marc, nagging you again, essentially to let you aware of discussed
> issues. This is probably not the last time as I'm currently digging
> into "wishlist" bugs for shadow)
>=20
> >From #173431:
>=20
> In the manpage of "userdel", I can read this: -r Files in the
> user's home directory will be removed along with the home
> directory itself and the user's mail spool. Files located in
> other file systems will have to be searched for and deleted
> manually.
>=20
> I think "userdel -r" could also remove the crontabs of the user at
> /var/spool/cron/crontabs/$USER
Christian look on comment in src/userdel.c::user_cancel():
/*
* user_cancel - cancel cron and at jobs
*
* user_cancel removes the crontab and any at jobs for a user
*/
/*
* We used to have all this stuff hardcoded here, but now
* we just run an external script - it may need to do other
* things as well (like removing print jobs) and we may not
* want to recompile userdel too often. Below is a sample
* script (should work at least on Debian 1.1). --marekm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#! /bin/sh
# Check for the required argument.
if [ $# !=3D 1 ]; then
echo Usage: $0 username
exit 1
fi
# Remove cron jobs.
crontab -r -u $1
# Remove at jobs. XXX - will remove any jobs owned by the same UID, even if
# it was shared by a different username. at really should store the usernam=
e
# somewhere, and atrm should support an option to remove all jobs owned by
# the specified user - for now we have to do this ugly hack...
find /var/spool/cron/atjobs -name "[^.]*" -type f -user $1 -exec rm {} \;
# Remove print jobs.
lprm $1
# All done.
exit 0
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
*/
If anyone will have other solution for removing at/cron jobs please=20
inform me.
kloczek
--=20
-----------------------------------------------------------
*Ludzie nie maj=B1 problem=F3w, tylko sobie sami je stwarzaj=B1*
-----------------------------------------------------------
Tomasz K=B3oczko, sys adm @zie.pg.gda.pl|*e-mail: kloczek@rudy.mif.pg.gda.p=
l*
--568760595-2049476239-1116959365=:27760--