forked from pool/shadow
57f8487ce4
- Use pure #!/bin/sh in: * useradd.local * userdel-post.local * userdel-pre.local OBS-URL: https://build.opensuse.org/request/show/808197 OBS-URL: https://build.opensuse.org/package/show/Base:System/shadow?expand=0&rev=88
33 lines
657 B
Bash
33 lines
657 B
Bash
#!/bin/sh
|
|
#
|
|
# Here you can add your own stuff, that should be done for every user
|
|
# who will be deleted.
|
|
#
|
|
# When you delete a user with userdel, this script will be called
|
|
# with the login name as parameter before any other action is done.
|
|
#
|
|
|
|
case "$1" in
|
|
--help|--version)
|
|
echo Usage: $0 username uid gid home
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
# Check for the required argument.
|
|
if [ $# != 1 ]; then
|
|
echo Usage: $0 username
|
|
exit 1
|
|
fi
|
|
|
|
# Remove cron jobs
|
|
test -x /usr/bin/crontab && /usr/bin/crontab -r -u $1
|
|
|
|
# Stop systemd user jobs, even this requires --force
|
|
id=$(id -u $1)
|
|
systemctl stop user@${id}.service > /dev/null 2>&1 &
|
|
|
|
# All done.
|
|
exit 0
|
|
|