Skip to content

Commit 583a205

Browse files
authored
v-import-cpanel email migration function starts even if there is no email accounts (hestiacp#4149)
check if there is mail account before proceeding with the function + no need for the "echo "All mail accounts restored" since each mail account show success message
1 parent 97a4719 commit 583a205

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

bin/v-import-cpanel

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@ for folder in *; do
285285
if [[ "$folder" != "cur" && "$folder" != "new" && "$folder" != "tmp" ]]; then
286286
echo "Domain: $folder"
287287
cd $folder
288+
289+
mail_account_count=$(find . -maxdepth 1 -mindepth 1 -type d \( ! -name cur ! -name new ! -name tmp \) | wc -l)
290+
if [ "$mail_account_count" -eq 0 ]; then
291+
echo "No mail accounts to restore for domain $folder."
292+
cd ..
293+
continue
294+
fi
295+
288296
for mail_account in *; do
289297
echo "Import mail account: $mail_account@$folder"
290298
# Doesn't really matter but we don't know the unhashed one
@@ -335,7 +343,6 @@ for folder in *; do
335343
fi
336344
fi
337345
done
338-
echo "All mail accounts restored"
339346

340347
if [ "$mx" = 'yes' ]; then
341348
cd $main_dir/dnszones

0 commit comments

Comments
 (0)