diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:54:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:54:37 +0000 |
commit | 97c26c1924b076ef23ebe4381558e8aa025712b2 (patch) | |
tree | 109724175f07436696f51b14b5abbd3f4d704d6d /man/login.defs.d/USERDEL_CMD.xml | |
parent | Initial commit. (diff) | |
download | shadow-97c26c1924b076ef23ebe4381558e8aa025712b2.tar.xz shadow-97c26c1924b076ef23ebe4381558e8aa025712b2.zip |
Adding upstream version 1:4.13+dfsg1.upstream/1%4.13+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'man/login.defs.d/USERDEL_CMD.xml')
-rw-r--r-- | man/login.defs.d/USERDEL_CMD.xml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/man/login.defs.d/USERDEL_CMD.xml b/man/login.defs.d/USERDEL_CMD.xml new file mode 100644 index 0000000..56c0933 --- /dev/null +++ b/man/login.defs.d/USERDEL_CMD.xml @@ -0,0 +1,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> |