I am trying to create a simple deployment script for my PHP applications. I know that there are several tools for this work (Capistrano, Phing, etc.), but they seem very useful for my simple deployment procedure.
I use sshpass to not enter my password again and again. But after downloading my compressed installer, I need ssh to the server and run some commands. One of them is sed. So the quotation marks break my script. This is something like this:
sshpass -p foo ssh user @ host "
cd / www / htdocs / foo / bar
echo 'Untar and remove installer'
tar -zxf install.tar.gz
sed "s / define ('ENVIRONMENT', 'development'); / define ('ENVIRONMENT', 'production');" index.php> tmp && mv tmp index.php
sed "s / define ('ENVIRONMENT', 'development'); / define ('ENVIRONMENT', 'production'); /" admin / index.php> tmp && mv tmp admin / index.php
"
As you can see, I use double quotes to run my SSH statements, but I also need to use them in sed.
Any suggestions would be greatly appreciated. Thank!
source
share