From: Michael Shigorin <mike@osdn.org.ua>
To: community@altlinux.ru
Subject: [Comm] Re: [JT] ротирование почты (was: Еще раз о скорости работы Sylpheed и Sylpheed-Claws)
Date: Tue, 24 May 2005 03:57:51 +0300
Message-ID: <20050524005751.GC13233@osdn.org.ua> (raw)
In-Reply-To: <20050524004431.201b79ec@vova.gusev.ru>
[-- Attachment #1.1: Type: text/plain, Size: 1336 bytes --]
On Tue, May 24, 2005 at 12:44:31AM +0400, Владимир Гусев wrote:
> > fly:~/mail> ls archive/_alt
> > 20020518 2002-11-04 2003-04-28 2003-09-29 2004-03-29 2005-02-14
> > 2002-07-10 2002-12-08 2003-05-11 2003-10-20 2004-05-24 2005-03-03
> > 2002-07-15 2002-12-30 2003-06-11 2003-11-17 2004-06-07 2005-03-14
> > 2002-07-23 2003-01-14 2003-06-16 2003-12-08 2004-08-02 2005-03-28
> > 2002-08-01 2003-01-26 2003-06-30 2003-12-26 2004-09-09 2005-04-04
> > 2002-08-21 2003-02-01 2003-08-05 2004-01-13 2004-10-18 2005-04-11
> > 2002-09-05 2003-02-10 2003-08-20 2004-01-19 2004-11-29 2005-04-25
> > 2002-09-23 2003-03-19 2003-09-02 2004-02-01 2004-12-29 2005-05-16
> > 2002-09-30 2003-04-14 2003-09-18 2004-02-11 2005-01-25
> Вот этот момент интересует - как по дате сортируете?
> Наверняка не вручную...
Ну, скажем так, гашу mutt'ы и пинаю mailrotate.sh всё же вручную,
обычно по понедельникам раз в две-четыре недели. Лень ещё раз
посмотреть, как бы о модификации культурно их уведомлять,
а просто килять как-то не хочется совсем. => no cron
Скриптик в аттаче, хоть и с изъяном -- mtime не сохраняет тот,
что был до ротирования; mutt считает, что туда ещё что-то пришло.
--
---- WBR, Michael Shigorin <mike@altlinux.ru>
------ Linux.Kiev http://www.linux.kiev.ua/
[-- Attachment #1.2: mailrotate.sh --]
[-- Type: text/plain, Size: 2045 bytes --]
#!/bin/sh
# A free script to rotate mail by Michael Shigorin <mike@altlinux.ru>
# v20011020
# moves $MBOXES (wildcards allowed) in $MAIL to files named after $DATEFMT in
# directories under $ARCROOT, leaving fresher than $KEEP (see also $SINCEAFTER)
# not to leave mailboxes empty.
# WARNING: BACKUP YOUR MAIL BEFORE USING! NO WARRANTIES!
MDIR="$HOME/mail"
ARCROOT="$MDIR/archive"
MBOXES="_* READ MDS"
LOG="$ARCROOT/mailrotate.log"
KEEP="7 days" # to leave me in context
KEEPEMPTY= # keep empty boxes? "" or non-empty string
SKIPEXIST= # skip existing archive mbox or append to it?
MODE=644 # mktemp will
DATEFMT="%Y-%m-%d"
SINCEAFTER=after # ...or "since". One day difference.
MAILPS="mutt" # egrep's regexp, i.e. (mutt|pine|sylpheed)
echo `date +$DATEFMT` >>$LOG
[ -n "`ps -u $USER | egrep " $MAILPS$"`" ] && {
echo "$MAILPS running as $USER, exiting..." >>$LOG
exit
} || echo "$0: starting..." >>$LOG
perl -e 'require Date::Parse; require Date::Manip' || {
echo "ERROR: grepmail needs Date::Parse and Date::Manip to" >&2
echo " enable -d option (which we need)." >&2
echo >&2
echo "Exiting to keep your mail safe; please run" >&2
echo "perl -MCPAN -e 'install Date::Parse' && perl -MCPAN -e 'install Date::Manip'" >&2
echo "as root to install the needed modules!" >&2
exit 1
}
cd "$MDIR"
for i in $MBOXES; do
[ ! -f "$i" -o -f "$i.lock" ] && continue
ARCDIR="$ARCROOT/$i"
[ -d "$ARCDIR" ] || mkdir -p "$ARCDIR"
ARCMBOX="$ARCDIR/`date -d "$KEEP ago" +$DATEFMT`"
[ -f "$ARCMBOX" -a "$SKIPEXIST" ] && continue
TMPFILE="`mktemp "$i.tmp-XXXXXX"`"
grepmail -had "$SINCEAFTER $KEEP ago" "$i" >"$TMPFILE" 2>>$LOG
# [ -f "$ARCMBOX" ] && echo "WARNING: $ARCMBOX already exists!" >>$LOG
grepmail -vhad "$SINCEAFTER $KEEP ago" "$i" >>"$ARCMBOX" 2>>$LOG
[ -s "$TMPFILE" -o "$KEEPEMPTY" ] && {
mv "$TMPFILE" "$i"
chmod $MODE "$i"
}
[ -s "$ARCMBOX" -o "$KEEPEMPTY" ] || rm -f "$ARCMBOX"
done
find "$MDIR/" -name '*.tmp-*' | xargs rm -rf
echo "$0: done." >>$LOG
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-05-24 0:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-23 11:47 [Comm] Еще раз о скорости работы Sylpheed и Sylpheed-Claws Владимир Гусев
2005-05-23 12:14 ` Alex Gorbachenko
2005-05-23 12:31 ` Владимир Гусев
2005-05-23 12:45 ` Alex Gorbachenko
2005-05-23 12:55 ` [Comm] " Michael Shigorin
2005-05-23 13:33 ` Владимир Гусев
2005-05-23 13:51 ` Alex Gorbachenko
2005-05-24 2:46 ` Re[2]: " Беляев Владимир Николаевич
2005-05-24 3:56 ` [Comm] [JT] " Pavel N. Solovyov
2005-05-24 8:15 ` [Comm] " Michael Shigorin
2005-05-24 8:48 ` Nick S. Grechukh
2005-05-24 9:48 ` Michael Shigorin
2005-05-24 3:51 ` [Comm] [JT[ " Pavel N. Solovyov
2005-05-23 13:57 ` [Comm] " Pavel N. Solovyov
2005-05-23 16:43 ` [Comm] [JT] " Michael Shigorin
2005-05-23 20:23 ` Владимир Гусев
2005-05-24 2:54 ` Andrey Rahmatullin
2005-05-24 5:51 ` Alexander Kirey
2005-05-23 20:44 ` Владимир Гусев
2005-05-24 0:57 ` Michael Shigorin [this message]
2005-05-24 2:23 ` Pavel N. Solovyov
2005-05-24 11:11 ` Grigory Fateyev
2005-05-23 15:38 ` [Comm] " Maxim Tyurin
2005-05-23 16:16 ` Владимир Гусев
2005-05-23 21:13 ` [Comm] " Aleksey Korotkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050524005751.GC13233@osdn.org.ua \
--to=mike@osdn.org.ua \
--cc=community@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git