wok-6.x rev 2349

Cyrus-imapd: initialize mailbox hash tree
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Mar 04 15:01:26 2009 +0000 (2009-03-04)
parents e82def084629
children 096d75757ea0
files cyrus-imapd/stuff/etc/init.d/cyrus-imapd
line diff
     1.1 --- a/cyrus-imapd/stuff/etc/init.d/cyrus-imapd	Wed Mar 04 12:10:47 2009 +0000
     1.2 +++ b/cyrus-imapd/stuff/etc/init.d/cyrus-imapd	Wed Mar 04 15:01:26 2009 +0000
     1.3 @@ -17,10 +17,23 @@
     1.4  
     1.5  case "$1" in
     1.6    start)
     1.7 -    if [ -f $PIDFILE ] ; then
     1.8 +    if active_pidfile $PIDFILE master ; then
     1.9        echo "$NAME already running."
    1.10        exit 1
    1.11      fi
    1.12 +    dir=$(grep configdirectory /etc/imapd.conf | awk '{ print $2 }')
    1.13 +    if [ -f $dir/mailboxes.db ]; then
    1.14 +      echo -n "Initialize $DESC: "
    1.15 +      for i in user quota ; do
    1.16 +        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
    1.17 +          [ -d $dir/$i/$j ] || mkdir -p $dir/$i/$j
    1.18 +        done
    1.19 +      done
    1.20 +      chown -R cyrus:mail $dir
    1.21 +      su cyrus -c "/usr/cyrus/bin/ctl_cyrusdb -r"
    1.22 +      su cyrus -c "/usr/cyrus/bin/reconstruct"
    1.23 +      status
    1.24 +    fi
    1.25      if ! pidof saslauthd > /dev/null; then
    1.26        /etc/init.d/cyrus-sasl start
    1.27      fi
    1.28 @@ -30,7 +43,7 @@
    1.29      sleep 2
    1.30      ;;
    1.31    stop)
    1.32 -    if [ ! -f $PIDFILE ] ; then
    1.33 +    if ! active_pidfile $PIDFILE master ; then
    1.34        echo "$NAME is not running."
    1.35        exit 1
    1.36      fi
    1.37 @@ -40,7 +53,7 @@
    1.38      status
    1.39      ;;
    1.40    restart)
    1.41 -    if [ ! -f $PIDFILE ] ; then
    1.42 +    if ! active_pidfile $PIDFILE master ; then
    1.43        echo "$NAME is not running."
    1.44        exit 1
    1.45      fi