-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jan-Willem Regeer wrote:
> 
> On Aug 8, 2005, at 4:52 PM, Matt Brookings wrote:
> 
> Rick Macdougall wrote:
> | Matt Brookings wrote:
> |> |
> |> | #!/bin/sh
> |> | #
> |> | # 06/21/05
> |> | # <[EMAIL PROTECTED]>
> |> | #
> |> | # Using vpopmail/domains directory, and locals file,
> |> | # generate rcpthosts, virtualdomains, and users/assign
> |> | #
> |> |
> |> | rm -f assign rcpthosts virtualdomains
> |> |
> |> | cat /var/qmail/control/locals > rcpthosts
> |> |
> |> | for i in *; do
> |> | ~        if [ ! -d $i ]; then
> |> | ~                continue;
> |> | ~        fi
> |> |
> |> | ~        echo "+$i-:$i:89:89:/home/vpopmail/domains/$i:-::" >>
> assign
> |> | ~        echo "$i" >> rcpthosts
> |> | ~        echo "$i:$i" >> virtualdomains
> |> | done
> |> |
> |> | echo "." >> assign

I just wanted to follow this posting up with a script that handles
hashed domains directories.  It's a little longer the previous one,
and may be a little fishy on older bash shells, but it should work
on any newer systems.  If you use it, let me know how it goes,
or any changes you feel should be made.

As the comment says at the top, you must name this script gen-hashed.sh
since it calls itself for recursion through the hashed directories,
and the script should be copied to ~vpopmail/domains and executed there.

Again, let me know how it goes!

#!/bin/sh
#
# Generate control files from hashed
# vpopmail domain tree.  Should be run
# from ~vpopmail/domains directory,
# and script should be named gen-hashed.sh
#
# <[EMAIL PROTECTED]>
#

SUB=""

rm -f users.assign control.rcpthosts control.virtualdomains

if [ $# -eq 1 ]; then
        CPWD=$PWD
        SUB=$1/
        cd $1
fi

for i in *; do
        if [ ! -d $i ]; then
                continue
        fi

        if [ ${#i} -eq 1 ]; then
                ~vpopmail/domains/gen-hashed.sh $i
                continue
        fi


        if [ "$CPWD" != "" ]; then
                CPWD="${CPWD}/"
        fi

        echo "+$i-:$i:89:89:$PWD/$i:-::" >> ${CPWD}users.assign
        echo "$i:$i" >> ${CPWD}control.virtualdomains
        echo "$i" >> ${CPWD}control.rcpthosts
done

if [ "$SUB" != "" ]; then
        cd $CPWD
fi

if [ $# -eq 0 ]; then
        echo "." >> ${CPWD}users.assign
fi

- --
/*
    Matt Brookings <[EMAIL PROTECTED]>       GnuPG Key B7B54216
    Software developer                     Systems technician
    Inter7 Internet Technologies, Inc.     (815)776-9465
*/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDLv4zhzYRRre1QhYRAiRFAJ4nah4+RVzvG9bWJGOLaBD4aj580gCeNtTV
k5cgtP2DJL5DE8+uJaZWmvc=
=Uis0
-----END PGP SIGNATURE-----

Reply via email to