# HG changeset patch # User Pascal Bellard # Date 1236178886 0 # Node ID 992291a415ab3182d5ab6c00815c702099b32f18 # Parent e82def084629bd84b27ec51483ea751b4ff605b1 Cyrus-imapd: initialize mailbox hash tree diff -r e82def084629 -r 992291a415ab cyrus-imapd/stuff/etc/init.d/cyrus-imapd --- a/cyrus-imapd/stuff/etc/init.d/cyrus-imapd Wed Mar 04 12:10:47 2009 +0000 +++ b/cyrus-imapd/stuff/etc/init.d/cyrus-imapd Wed Mar 04 15:01:26 2009 +0000 @@ -17,10 +17,23 @@ case "$1" in start) - if [ -f $PIDFILE ] ; then + if active_pidfile $PIDFILE master ; then echo "$NAME already running." exit 1 fi + dir=$(grep configdirectory /etc/imapd.conf | awk '{ print $2 }') + if [ -f $dir/mailboxes.db ]; then + echo -n "Initialize $DESC: " + for i in user quota ; do + for j in a b c d e f g h i j k l m n o p q r s t u v w x y z ; do + [ -d $dir/$i/$j ] || mkdir -p $dir/$i/$j + done + done + chown -R cyrus:mail $dir + su cyrus -c "/usr/cyrus/bin/ctl_cyrusdb -r" + su cyrus -c "/usr/cyrus/bin/reconstruct" + status + fi if ! pidof saslauthd > /dev/null; then /etc/init.d/cyrus-sasl start fi @@ -30,7 +43,7 @@ sleep 2 ;; stop) - if [ ! -f $PIDFILE ] ; then + if ! active_pidfile $PIDFILE master ; then echo "$NAME is not running." exit 1 fi @@ -40,7 +53,7 @@ status ;; restart) - if [ ! -f $PIDFILE ] ; then + if ! active_pidfile $PIDFILE master ; then echo "$NAME is not running." exit 1 fi