From kromonos, 7 Months ago, written in Bash.
Embed
  1. #!/bin/bash
  2. HEALTH="https://health.error.cf/ping/00000000-0000-0000-0000-000000000000"
  3. curl -fsS --retry 3 "${HEALTH}/start"
  4. DATE=$(date +%Y%m%d%I%m%P)
  5. SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
  6. cd ${SCRIPTPATH}
  7. imapsync/imapsync \
  8.    --logdir /var/log/imapsync \
  9.    --logfile ${DATE}_imapsync.log \
  10.    --minage 180 \
  11.    --delete \
  12.    --host1 mail.productive.com \
  13.    --user1 ich@productive.com \
  14.    --tls1 \
  15.    --password1 "meinsupergeheimespasswort" \
  16.    --host2 mail.archive.local \
  17.    --user2 ich@archive.local \
  18.    --password2  "meinsupergeheimespasswort" \
  19.    --nossl2 \
  20.    --notls2 > /dev/null
  21. LOG=$(awk '/Check if a new imapsync /{f=0} f; /++++ Statistics/{f=1}' /var/log/imapsync/${DATE}_imapsync.log)
  22. curl -fsS --retry 3 -X POST --data "${LOG}" "${HEALTH}$([ $? -ne 0 ] && echo -n /fail)"
  23.