jplew / SyncDB

Bash script meant to take the tedium out of deploying and updating database-driven (eg Wordpress) websites. It rapidly synchronizes local and remote versions of a MySQL database, performs the necessary search and replace queries, then synchronizes all your uploads/binaries.
MIT License
234 stars 41 forks source link

search/replace not working on remote after push #5

Closed joshuaiz closed 10 years ago

joshuaiz commented 10 years ago

Getting the following error:

Error: could not find /usr/bin/php. Locate your server's version of the php command line interface (php-cli) and assign it to the variable $r_php.

Thus, all my remote links are still mydomain:8888/...

How can I fix? Is this something on my remote server (DreamHost)?

jplew commented 10 years ago

Hi Josh: The search and replace CLI script uses /usr/bin/php to run, so it won't work if your executable is not actually located there. To find out where yours is kept on the server, login via the command line and type: which php. This will tell you which php binary your server is presently configured to use. I also have a Dreamhost shared account, and mine was kept /usr/local/bin/php.

Next, go to line 66 of the sync script, and set r_php to the correct value: r_php=/usr/local/bin/php

There's a chance that that particular version of php is too old (you can check by typing php -v). If I recall correctly the CLI script only works with PHP 5.3 or higher. In that case, find the right version of PHP on your server. Mine was located at /usr/local/bin/php-5.3. Use that for r_php and you should be good from there.

Let me know if it doesn't work.

joshuaiz commented 10 years ago

Ok I updated that but getting these errors:


Checking for existence of remote directories...

scp ./syncdb [my dh login]:~/mydomain.com/

: No such file or directory

[my dh login]:~/mydomain.com/.bak/latest-remote.mssql.bz2 . cp: fts_open: No such file or directory latest-remote.mssql.bz2 100% 56KB 56.0KB/s 00:01
Error: Download did not work. Exiting.


Strange because the last time I used your script with this site everything worked and I hadn't updated PHP or anything else on the server or in the script. The backup files are in the .bak directory.

Should I use another host name?

J

On Apr 3, 2014, at 9:16 AM, JP Lew notifications@github.com wrote:

Hi Josh: The search and replace CLI script uses /usr/bin/php to run, so it won't work if your executable is not actually located there. To find out where yours is kept on the server, login via the command line and type: which php. This will tell you which php binary your server is presently configured to use. I also have a Dreamhost shared account, and mine was kept /usr/local/bin/php.

Next, go to line 66 of the sync script, and assign r_php to the path you found above, like this: r_php=/usr/local/bin/php

There's a chance that that particular version of php is too old (you can check by typing php -v). If I recall correctly the CLI script only works with PHP 5.3 or higher. In that case, find the right version of PHP on your server. Mine was located at /usr/local/bin/php-5.3. Use that for r_php and you should be good from there.

Let me know if it doesn't work. script won't work unless you replace

— Reply to this email directly or view it on GitHub.

jplew commented 10 years ago

are you trying to do a pull?

Can you confirm whether the download actually succeeded? Does latest-remote.mssql.bz2 actually exist in your local .bak folder, and does it have the right modification date on it?

Also what is fts_open?

joshuaiz commented 10 years ago

Yes I was trying to do a pull.

I don't need to now as I have restored everything to where it was. Maybe I will try a push again in a bit. Although I am a bit weary as it took a little while to get everything back.

the latest-remote file exists in my local .bak folder and the modification date is from about an hour ago which is correct.

Re: what is fts_open? I have no idea - I thought you would know :)

J

On Apr 3, 2014, at 9:39 AM, JP Lew notifications@github.com wrote:

are you trying to do a pull?

Can you confirm whether the download actually succeeded? Does latest-remote.mssql.bz2 actually exist in your local .bak folder, and does it have the right modification date on it?

Also what is fts_open?

— Reply to this email directly or view it on GitHub.

jplew commented 10 years ago

ok, sorry for the inconvenience, and thanks for your help testing. If you do venture to pull again, I was going to ask you to replace line 407 as follows:

before: if [ $? == 0 -a -f ${r_bak_name2}.bz2 ]; then after: if [ -f ${r_bak_name2}.bz2 ]; then

I'll try testing on my side in the meantime. Cheers.

joshuaiz commented 10 years ago

Do you have a personal email that you can send to joshuaiz at me dot com so I can send you my current syncdb script and the command line output?

Just did a push again and getting the same errors even after updating the r_php setting. None of the urls are being replaced on remote.

J

On Apr 3, 2014, at 9:47 AM, JP Lew notifications@github.com wrote:

ok, sorry for the inconvenience, and thanks for your help testing. If you do venture to pull again, I was going to ask you to replace line 407 as follows:

before: if [ $? == 0 -a -f ${r_bak_name2}.bz2 ]; then after: if [ -f ${r_bak_name2}.bz2 ]; then

I'll try testing on my side in the meantime. Cheers.

— Reply to this email directly or view it on GitHub.

jplew commented 10 years ago

fixed in release 0.2.1