Parse if there have been new mails synched to the local dir.
Profpatsch
mail at profpatsch.de
Wed Jan 30 00:47:09 GMT 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/29/2013 11:37 PM, Tomasz Żok wrote:
> [Account NAME] ... postsynchook = /path/to/any/script.sh
That’s a cool way to execute manual scripts, might use it. I’m not
sure yet, how to do it with cron (or rather: fcron), normal syncs and
quick syncs.
> 1) To check how many new messages you have: find /path/to/MAILDIR/
> -type f -wholename '*/new/*' | wc -l
>
> 2) To check how many old but unseen messages you have: find
> /path/to/MAILDIR/ -type f -regex '.*/cur/.*2,[^S]*$' | wc -l
Now that’s brilliant.
Should have checked the maildir spec first.
> An even better option would be to use inotify which will not use
> any CPU or disk IO. It will be simply informed by kernel when new
> email shows up. I had once such script, but lost it and did not
> have motivation to rewrite it yet ;). But it is possible in a shell
> script, it is nothing complicated so maybe someone else from the
> mailing list came with such solution and would like to share.
Well, it’s not like the kernel doesn’t need to spend lots of cycles
checking for changes on the files, is it?
Having inotify idling around all the time might use more resources
than checking every time offlineimap executes with a quick (and maybe
even cached) find.
But that’s probably just my uninformed-ness and inotify doesn’t use
anything.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRCG2KAAoJEMXP0IsiJHzfnBQP/A/MM6gk2zrWBgmvYBxX9LTp
dlwZCq24mLDOocPElQb0cRlj2j55HvJV5eghpZO6GSs2+YnOyfCTKgYqYlSDFrHw
gdsEKVe7wQbUshTdV2pugOaJG36Y0stGDgTcLukcSPZGki/Lmniei7mqlTjKQuh3
ADftMTxF9LGtDxWOdjHu3Gm14i7LEiJYbYZAQ1d+6gY2j5JqDSQxkU7uL3j0nuyA
kwNX9NvuXt/eTeYzVzf/o5ReQaU2LAw6igYndBFtLgCUlwaWChPmUTzfG3OWPuX8
iAqhLyWOmrJRDpDZMdEDGk/0AzUS/AqYU5E9K2WRjCFJncdw5/W2EzGdU8KcAtZ4
joeHLw0hRM+rACpaorhJXZa3zH8mpke9q6N2i7MquQRA3auRe0bgIi83RIyWuaAO
Jd/cRR/N6/mlFv7Xc1WcXtZFZtXiuTPrzNZmCOV3kDz512McE/IbksnkjbYncSg9
rEZOXDOFcSm9A8QJjUgcPBAPO7+ylVGy/w3iwKcGpPo0Z4lUxaYRLpnFoET9nLo3
XX1jBFlqG7RjrgvC+ZZ24JAfntzCptDQoqQzekPyom536sFTmoiMjicWyO+c2x9/
9OJqZs0WLsPx0OV+VkD967H4CH4dUBibIP/VIDrGCDNMeA5+rwDvvgWFVdlE1PMr
zCBj5tBfZGErDAMO6W7c
=qwC2
-----END PGP SIGNATURE-----
More information about the OfflineIMAP-project
mailing list