Last active
February 12, 2017 15:30
-
-
Save ChatchaiJ/40327a0a135c24a6f3748044731174b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VER="3.0.0" | |
ZABBIXSRC="zabbix-${VER}.tar.gz" | |
SQLDIR="zabbix-${VER}/database/mysql" | |
[ ! -f "$ZABBIXSRC" ] && echo "Source file '$ZABBIXSRC' does not exist?" && exit | |
tar -zxvf ${ZABBIXSRC} ${SQLDIR} | |
[ ! -d "$SQLDIR" ] && echo "Hmmm? Can't extract MySQL files from Zabbix Source." && exit | |
WORKDIR=`pwd` | |
cd $SQLDIR | |
[ ! -f "schema.sql" -o ! -f "images.sql" -o ! -f "data.sql" ] && \ | |
echo "SQL files missing, please check!" && \ | |
exit | |
cat << EOT > $WORKDIR/cmd.sql | |
create database zabbix character set utf8 collate utf8_bin; | |
grant all privileges on zabbix.* to zabbix@localhost identified by 'root'; | |
connect zabbix; | |
source schema.sql; | |
source images.sql; | |
source data.sql; | |
exit; | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment