diff --git a/imageroot/actions/configure-module/91import-email b/imageroot/actions/configure-module/91import-email index f9d222f..dbb9d42 100755 --- a/imageroot/actions/configure-module/91import-email +++ b/imageroot/actions/configure-module/91import-email @@ -6,8 +6,4 @@ # # This script is used to start the import-email-to-piler.service -if [[ -f 'sync2pilerdone' ]]; then - echo "## sync2pilerdone file is found, mail already migrated, exiting" - exit 0 -fi systemctl --user start --no-block import-email-to-piler.service diff --git a/imageroot/systemd/user/import-email-to-piler.service b/imageroot/systemd/user/import-email-to-piler.service index 60e3160..a012eae 100644 --- a/imageroot/systemd/user/import-email-to-piler.service +++ b/imageroot/systemd/user/import-email-to-piler.service @@ -3,9 +3,10 @@ # SPDX-License-Identifier: GPL-3.0-or-later # [Unit] -Description= import emails to piler +Description=Import emails to Piler +ConditionPathExists=!%S/state/sync2pilerdone [Service] ExecStart=/usr/local/bin/runagent import-emails -ExecStart=/usr/bin/touch sync2pilerdone +ExecStart=/usr/bin/touch %S/state/sync2pilerdone Type=oneshot