Can someone please help me with this problem, I've got 2 files called tool.SH and frebsh_tool.SH so I edited them both, as follows Oh and my mysql pass and user is both 'root' and navicat database names are called world and accounts
Tool.sh
Code:
#!/bin/bash
# Academico's tool for NCDB
user="root"
pass="root"
wdb="world"
cdb="accounts"
server="127.0.0.1"
devpath=Development/Database
pubpath=Releases
until [ $letter == x ]
do
clear
echo "####################################"
echo "####### Next Chapter #######"
echo "###### Database ######"
echo "####### Import Tool #######"
echo "####################################"
echo
echo "Please type the letter for the option:"
echo "w = Install NCDB World Database"
echo "c = Install NCDB Clean Character Database"
echo
echo "b - Backup Characters/Acounts Data"
echo "r - Restore Characters/Accounts Data"
echo
echo "d - Debug"
echo "x - Exit"
read -p "Enter option: " letter
if [ ! $letter ]; then
echo
echo "Enter correct option... "
read -p "Press any key to try again..."
echo
else
if [ $letter == w ]; then
echo "[Importing] Started..."
for i in $( ls -C -1 $devpath/tables_world/*.sql | cut -d'.' -f1 );
do
if [ $i != "Development/Database/tables_world/character_tables" ]; then
echo "[Importing]" $i.sql...
mysql -h $server --user=$user --password=$pass $wdb < $i.sql
fi
done
echo "Importing Finished..."
fi
if [ $letter == c ]; then
clear
echo "! ! ! W A R N I N G ! ! !"
echo
echo
echo "This will DELETE all existing Character data"
echo "from the database!"
echo
echo "Are you sure you want to:"
echo "Install clean Character Database?"
echo
echo "'yes' or 'no'"
read -p "Enter option: " resp
if [ $resp != "yes" ]; then
echo "Aborting..."
exit
else
echo "[Importing] Started..."
echo "[Importing] Importing Character/Account tables..."
mysql -h $server --user=$user --password=$pass $cdb < $pubpath/character.sql
echo "[Importing] Finished"
echo
fi
fi
if [ $letter == b ]; then
echo "[Backing Up] Started..."
echo "[Backing Up] User Accounts and Characters..."
mysqldump -h $server --user=$user --password=$pass $cdb accounts auctions characters charters corpses gm_tickets guilds guild_ranks instances ipbans mailbox playeritems playerpets playerpetspells playersummonspells questlog playercooldownitems playercooldownsecurity social tutorials > $pubpath/Backups/characters_backup.sql
echo "[Backing Up] Finished"
fi
if [ $letter == r ]; then
clear
echo "! ! ! W A R N I N G ! ! !"
echo
echo
echo "This will DELETE all existing Character data"
echo "from the database!"
echo
echo "Are you sure you want to:"
echo "Restore Character Database from a file?"
echo
echo "'yes' or 'no'"
read -p "Enter option: " resp
if [ $resp != "yes" ]; then
echo "Aborting..."
exit
else
echo "[Restoring] Started..."
echo "[Restoring] User Accounts and Characters..."
mysql -h $server --user=$user --password=$pass $cdb < $pubpath/Backups/characters_backup.sql
echo "[Restoring] Finished"
echo
fi
fi
if [ $letter == d ]; then
clear
echo "####################################"
echo "###### Next Chapter ######"
echo "##### Database #####"
echo "###### Debug Tool ######"
echo "####################################"
echo
echo "User = $user"
echo "Password = $pass"
echo "World DB = $wdb"
echo "Char DB = $cdb"
echo "Server = $server"
echo "Development Directory Path = $devpath"
echo "Releases Directory Path = $pubpath"
fi
fi
if [ $letter != x ]; then
echo
read -p "press a key to continue..."
echo
fi
echo "Thanks for using NCDB tool!!"
done
And frebsd_tool.SH
Code:
#!/bin/bash
# Academico's tool for NCDB
user="root"
pass="root"
wdb="world"
cdb="accounts"
server="127.0.0.1"
devpath=Development/Database
pubpath=Releases
until $letter == x
do
clear
echo "####################################"
echo "####### Next Chapter #######"
echo "###### Database ######"
echo "####### Import Tool #######"
echo "####################################"
echo
echo "Please type the letter for the option:"
echo "w = Install NCDB World Database"
echo "c = Install NCDB Clean Character Database"
echo
echo "b - Backup Characters/Acounts Data"
echo "r - Restore Characters/Accounts Data"
echo
echo "d - Debug"
echo "x - Exit"
read -p "Enter option: " letter
if ! $letter; then
echo
echo "Enter correct option... "
read -p "Press any key to try again..."
echo
else
if $letter == w ; then
echo "[Importing] Started..."
for i in $( ls -C -1 $devpath/tables_world/*.sql | cut -d'.' -f1 );
do
if $i != "Development/Database/tables_world/character_tables" ; then
echo "[Importing]" $i.sql...
mysql -h $server --user=$user --password=$pass $wdb < $i.sql
fi
done
echo "Importing Finished..."
fi
if $letter == c ; then
clear
echo "! ! ! W A R N I N G ! ! !"
echo
echo
echo "This will DELETE all existing Character data"
echo "from the database!"
echo
echo "Are you sure you want to:"
echo "Install clean Character Database?"
echo
echo "'yes' or 'no'"
read -p "Enter option: " resp
if $resp != "yes" ; then
echo "Aborting..."
exit
else
echo "[Importing] Started..."
echo "[Importing] Importing Character/Account tables..."
mysql -h $server --user=$user --password=$pass $cdb < $pubpath/character.sql
echo "[Importing] Finished"
echo
fi
fi
if $letter == b ; then
echo "[Backing Up] Started..."
echo "[Backing Up] User Accounts and Characters..."
mysqldump -h $server --user=$user --password=$pass $cdb accounts auctions characters charters corpses gm_tickets guilds guild_ranks instances ipbans mailbox playeritems playerpets playerpetspells playersummonspells questlog playercooldownitems playercooldownsecurity social tutorials > $pubpath/Backups/characters_backup.sql
echo "[Backing Up] Finished"
fi
if $letter == r ; then
clear
echo "! ! ! W A R N I N G ! ! !"
echo
echo
echo "This will DELETE all existing Character data"
echo "from the database!"
echo
echo "Are you sure you want to:"
echo "Restore Character Database from a file?"
echo
echo "'yes' or 'no'"
read -p "Enter option: " resp
if $resp != "yes" ; then
echo "Aborting..."
exit
else
echo "[Restoring] Started..."
echo "[Restoring] User Accounts and Characters..."
mysql -h $server --user=$user --password=$pass $cdb < $pubpath/Backups/characters_backup.sql
echo "[Restoring] Finished"
echo
fi
fi
if $letter == d ; then
clear
echo "####################################"
echo "###### Next Chapter ######"
echo "##### Database #####"
echo "###### Debug Tool ######"
echo "####################################"
echo
echo "User = $user"
echo "Password = $pass"
echo "World DB = $wdb"
echo "Char DB = $cdb"
echo "Server = $server"
echo "Development Directory Path = $devpath"
echo "Releases Directory Path = $pubpath"
fi
fi
if $letter != x ; then
echo
read -p "press a key to continue..."
echo
fi
echo "Thanks for using NCDB tool!!"
done
Hope some1 can help with this, thanks in advanced also +Rep