* src/userdel.c, man/login.defs.d/USERDEL_CMD.xml: Move the
USERDEL_CMD script example from the source code to the documentation.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<!--
|
||||
Copyright (c) 1991 - 1993, Julianne Frances Haugh
|
||||
Copyright (c) 1991 - 1993, Chip Rosenthal
|
||||
Copyright (c) 2007 - 2008, Nicolas François
|
||||
Copyright (c) 1996 - 2000, Marek Michałkiewicz
|
||||
Copyright (c) 2007 - 2009, Nicolas François
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,5 +37,35 @@
|
||||
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.
|
||||
find /var/spool/cron/atjobs -name "[^.]*" -type f -user $1 -exec rm {} \;
|
||||
|
||||
# Remove print jobs.
|
||||
lprm $1
|
||||
|
||||
# All done.
|
||||
exit 0
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
Reference in New Issue
Block a user