2008-10-11 17:14:43 +05:30
|
|
|
<!--
|
2021-12-05 21:05:27 +05:30
|
|
|
SPDX-FileCopyrightText: 1991 - 1993, Julianne Frances Haugh
|
|
|
|
SPDX-FileCopyrightText: 1991 - 1993, Chip Rosenthal
|
|
|
|
SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
|
|
|
SPDX-FileCopyrightText: 2007 - 2009, Nicolas François
|
|
|
|
SPDX-License-Identifier: BSD-3-Clause
|
2008-10-11 17:14:43 +05:30
|
|
|
-->
|
2007-11-27 03:41:23 +05:30
|
|
|
<varlistentry>
|
|
|
|
<term><option>USERDEL_CMD</option> (string)</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If defined, this command is run when removing a user. It should
|
|
|
|
remove any at/cron/print jobs etc. owned by the user to be removed
|
|
|
|
(passed as the first argument).
|
|
|
|
</para>
|
2009-05-13 00:53:46 +05:30
|
|
|
<para>
|
|
|
|
The return code of the script is not taken into account.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Here is an example script, which removes the user's
|
|
|
|
cron, at and print jobs:
|
|
|
|
<programlisting>
|
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
# Check for the required argument.
|
|
|
|
if [ $# != 1 ]; then
|
|
|
|
echo "Usage: $0 username"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove cron jobs.
|
|
|
|
crontab -r -u $1
|
|
|
|
|
|
|
|
# Remove at jobs.
|
|
|
|
# Note that it will remove any jobs owned by the same UID,
|
|
|
|
# even if it was shared by a different username.
|
2009-05-21 17:32:12 +05:30
|
|
|
AT_SPOOL_DIR=/var/spool/cron/atjobs
|
|
|
|
find $AT_SPOOL_DIR -name "[^.]*" -type f -user $1 -delete \;
|
2009-05-13 00:53:46 +05:30
|
|
|
|
|
|
|
# Remove print jobs.
|
|
|
|
lprm $1
|
|
|
|
|
|
|
|
# All done.
|
|
|
|
exit 0
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
2007-11-27 03:41:23 +05:30
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|