I am trying to create a
sync.sh script that coordinates with our less-than-ideal version control for our website. This script will migrate a copy of the live database to our local development environment and a couple other things. I'm having trouble with the mysql migration portion.
This script is run on a development machine.
remote is the live host.
# -------------- # database # ssh tunnel ssh -L 3307:remote:3306 user@remote # mysql dump mysqldump -u someuser -h remote -P 3307 -p"p4ssw0rd" db > localfile.sql # somehow close ssh tunnel ??? # populate local db with sql dump file mysql -ulocal db < localfile.sql # ----------------- # other sync stuff # ...
When I just run the mysql portion of the script, I'm getting this output:
Pseudo-terminal will not be allocated because stdin is not a terminal. Enter password:
We have ssh keys setup and I can ssh to the remote properly. However, when run in the script context, things are going wrong. I think I'm just a total bash noob. I'm guessing that if I simply change the structure of my approach, I should have no problem. I'm just not sure how to do that...