#!/bin/bash
#
#  Sample dbmail.sh script to help you
#  test and administer dbmail via webmin
#
#  Jacques Beaudoin
#
#  History:  2003/03/19  Added quotes to parameters
#                                     (Thanks to Paul Stevens)
#                 2003/03/18  First sample
#
#
#   1: Download and install webmin rpm from www.webmin.com
#   2: Put this scrip in /root and give it the execute permission
#   3: start your browser
#   4: enter webmin by typing       http://127.0.0.1:10000
#      or your mail server address  http://x.x.x.x:10000
#   5: clic others
#   6: clic custom commands
#   7: to create the ADD A USER command in webmin
#
#      clic create a new custom command
#      Description: ADD A USER
#          Command: /root/dbmail.sh "ADD"
#      Run as user: root
#      Under command parameters
#             Name: USER
#      Description: USER
#             NAME: PASSWORD
#      Description: PASSWORD
#
#   8: to create the INFO FOR A USER command in webmin
#
#      clic create a new custom command
#      Description: INFO FOR A USER
#          Command: /root/dbmail.sh "INFO"
#      Run as user: root
#      Under command parameters
#             Name: USER
#      Description: USER
#
#   9: to create the DELETE A USER command in webmin
#
#      clic create a new custom command
#      Description: INFO FOR A USER
#          Command: /root/dbmail.sh "DELETE"
#      Run as user: root
#      Under command parameters
#             Name: USER
#      Description: USER
#
#  10: to create the  LIST ALL USERS command in webmin
#
#      clic create a new custom command
#      Description: LIST ALL USERS
#          Command: /root/dbmail.sh "LIST"
#      Run as user: root
#
#  11: If you understand what going on you can modified
#        this script and webmin to make your simple
#        dbmail web administration tool.
#
#        Important:
#        Dont forget to explore the Type(Menu) option
#        you can redirect your users in a file and
#        point and clic a user
#

OPTION="$1"
QUOTA=15M                              # DEFAULT QUOTA
DOMAIN="your.domain.com"     # YOUR DOMAIN NAME
BINARY="/usr/local/bin"            # WHERE ARE YOUR DBMAIL PROGRAM

#
#  CHANGE TO ROOT
#

cd /root

#
#  ADD A USER
#

if [ $OPTION = "ADD" ]; then
$BINARY/dbmail-adduser a "$USER" "$PASSWORD" 0 "$QUOTA" "[EMAIL PROTECTED]"
exit 0
fi

#
#  INFO FOR A USER
#

if [ $OPTION = "INFO" ]; then
$BINARY/dbmail-adduser s "$USER"
exit 0
fi

#
#  DELETE A USER
#

if [ $OPTION = "DELETE" ]; then
$BINARY/dbmail-adduser d "$USER"
exit 0
fi

#
#  LIST ALL USERS
#

if [ $OPTION = "LIST" ]; then
mysql -s -u root  -e "SELECT userid from dbmail.users"
#
# Use this to redirect to a file to use webmin Type(Menu)
#
#mysql -s -u root  -e "SELECT userid from dbmail.users" > /root/users
exit 0
fi

#
#  NO SUCH OPTION
#
   echo "OPTION $OPTION FOR DBMAIL.SH NO SUCH OPTION"
   exit 0














Reply via email to