#!/bin/sh #----------------------------------- # Script to create : # -MySQL Database "mailstats" # -MySQL user "mailstats" # -tables for "mailstats" # 20080412 hartmut_at_trepkau.de # 20080413 brianr@bjsystems.co.uk #----------------------------------- #Start by deleting the db if it already exists mysqladmin -f drop mailstats # database creation mysqladmin create mailstats 2>err if [ $? -ne 0 ] then echo -n "Error in the creation of the database : " cat err else echo -e "Database creation :\t\t\t[OK]" fi # user creation mysql -e " grant all privileges on mailstats.* \ to 'mailstats'@'localhost' \ identified by 'mailstats' " 2>err if [ $? -ne 0 ] then echo -n "Error in the creation of mysql user : " cat err else echo -e "Creation of mysql user :\t\t[OK]" fi # table creation mysql mailstats < tables.sql 2>err if [ $? -ne 0 ] then echo -n "Error in the creation of the tables : " cat err else echo -e "Creation of tables :\t\t\t[OK]" fi rm -f err # validation of modifications mysqladmin flush-privileges /sbin/e-smith/db configuration setprop mailstats SaveDataToMySQL yes echo "Mailstats data save enabled" /sbin/e-smith/db configuration show mailstats echo -e "/n" .