crontab file of a deleted user
By default, userdel
doesn't remove the user's cron, at
, and print jobs. To do it, uncomment the following line in /etc/login.defs
:
USERDEL_CMD /usr/sbin/userdel_local
Here is an example of userdel_local
script:
#! /bin/sh
if [ $# != 1 ]; then
echo "Usage: $0 username"
exit 1
fi
crontab -r -u $1
So, whenever you execute userdel
, any cron jobs owned by the user will be remove.