+ printf "%s\n" "$cursor" >$file
+ fi
+ if (( errors == 1 )); then
+ send_mail=true
+ fi
+ fi
+ if $send_mail; then
+ echo "sysd-mail-once: emailing on $errors errors. exit code: $code"
+ mi exim -odf -t <<EOF
+To: $to
+From: $USER@$(hostname -f)
+Subject: $HOSTNAME: $service exit code: $code
+
+$(journalctl -u $service.service --after-cursor="$(<$file)")
+EOF
+ fi
+else
+ if [[ $file ]]; then
+ m rm -f $file
+ if [[ $file == $c$errors ]]; then
+ echo "sysd-mail-once: emailing success after >= $errors errors."
+ mi exim -odf -t <<EOF
+To: $to
+From: $USER@$(hostname -f)
+Subject: $HOSTNAME: $service success
+
+EOF