Fix bug introduced in f2f115608a (op del fails when user has no crontab)

This commit is contained in:
William Hirigoyen (Evolix) 2022-05-11 14:39:00 +02:00
parent d63046b227
commit 93629b51fb
1 changed files with 4 additions and 2 deletions

View File

@ -735,8 +735,10 @@ op_del() {
set -x
# Crontab dump needs to be done **before** user deletion
crontab -l -u "$login" &> /home/$login/crontab-$(date '+%Y%m%d-%H%M%S').bak
crontab -r -u "$login"
if crontab -l -u "$login"; then
crontab -l -u "$login" &> /home/$login/crontab-$(date '+%Y%m%d-%H%M%S').bak
crontab -r -u "$login"
fi
if [ "$WEB_SERVER" == "apache" ]; then
if id www-"$login" &> /dev/null; then