My dotfiles for my Linux rice managed with stow and make
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.offlineimapsync.sh 494B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. imapserver=$(cat ~/.offlineimaprc | grep remotehost | awk '{print $3}')
  3. imapactive=$(ps -ef | grep '/usr/bin/[o]fflineimap' | wc -l)
  4. netactive=$(ping -c3 $imapserver > /dev/null 2>&1 && echo up || echo down)
  5. mailsync="/usr/bin/offlineimap -u quiet -q"
  6. case $imapactive in
  7. '1')
  8. echo "killing offlineimap"
  9. killall offlineimap
  10. killall offlineimap
  11. killall offlineimap
  12. ;;
  13. esac
  14. case $netactive in
  15. 'up')
  16. echo "syncing mail"
  17. $mailsync
  18. ;;
  19. 'down')
  20. :
  21. ;;
  22. esac
  23. echo "FINISHED"