summaryrefslogtreecommitdiffstats
path: root/man/login.defs.d/USERDEL_CMD.xml
diff options
context:
space:
mode:
Diffstat (limited to 'man/login.defs.d/USERDEL_CMD.xml')
-rw-r--r--man/login.defs.d/USERDEL_CMD.xml48
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>