blob: 56c0933c595542a04e1b909162dd2b428a98a9bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<!--
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
-->
<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>
<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.
AT_SPOOL_DIR=/var/spool/cron/atjobs
find $AT_SPOOL_DIR -name "[^.]*" -type f -user $1 -delete \;
# Remove print jobs.
lprm $1
# All done.
exit 0
</programlisting>
</para>
</listitem>
</varlistentry>
|