Maildir IMAP

From Wiki
Jump to: navigation, search

This script only is an example to show how to use bash as script language. This script will only work on my system, so don't try to execute it



#!/bin/bash
# check the size of Maildir folder of a user#

DIRECTORI_BUSTIES="/users/ldap/col1"

printUsage( )
{
        echo "Arguments incorrectes!!"
        echo "Usage: llistar-tamany-bustia <usuari> "
        echo ""
        return 1
}


# if not exists an argument or if the argument list is greater than 2 error
if [[ -z "$1" ]] ||  [[ $# -gt 2 ]]

then
        printUsage
        exit
fi

USUARI="$1"


# if the Maildir folder does not exists in col1, let's check in col2
if [[ ! -d  $DIRECTORI_BUSTIES/$USUARI/Maildir ]]

then
DIRECTORI_BUSTIES="/users/ldap/col2"
fi

# our mailboxes are stored in another locaion, let's read the physical link
DIRECTORI=`readlink -fn $DIRECTORI_BUSTIES/$USUARI/Maildir`

# let's make a list of user with the size and location of his maildir folder
echo $USUARI `du -s $DIRECTORI`


Personal tools
Namespaces
Variants
Actions
Navigation
Content
Toolbox