citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

email-status-once (550B)


      1 #!/usr/bin/env bash
      2 
      3 service=email-fetcher
      4 
      5 queued=$(ls -1 /home/jb55/.msmtp.queue | grep \.mail | wc -l)
      6 
      7 time=$(journalctl --user -n1 --no-pager --output=short-iso -u $service | tail -n1  | cut -d " " -f1 | xargs -I{} date -d {} '+%F %R')
      8 
      9 diff=$(datediff --format="%Hh:%Mm" "$time" "$(date '+%F %R')")
     10 
     11 last_email=$(notmuch search --format=json --limit=1 --sort=newest-first date:today | jq -r '.[0].date_relative')
     12 
     13 printf "last email $last_email | fetched $diff ago | $queued queued | "
     14 journalctl --user -n1 --no-pager --output=cat -u $service