Where does your script currently reside? (In a Trellis/Bedrock setup, it should go in the āsiteā folder).
And where are you running the script? You should be running it from the same directory where the script exists (again the āsiteā folder if youāre using Bedrock).
read -r -p "Would you really like to reset THE STAGING DATABASE and send up the latest from dev? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
wp @development db export sql-dump-development.sql
scp sql-dump-development.sql web@staging.example.com:/srv/www/example.com/current
wp @staging db export just-in-case-$(date +%Y-%m-%d_%T).sql
wp @staging db reset --yes
wp @staging db import sql-dump-development.sql
wp @staging search-replace http://example.dev https://staging.example.com
scp -r web/app/uploads/ web@staging.example.com:/srv/www/example.com/shared
ssh vagrant@example.dev 'rm /srv/www/example.com/current/sql-dump-development.sql'
ssh web@staging.example.com 'rm /srv/www/example.com/current/sql-dump-development.sql'
else
exit 0
fi
I would appreciate it if someone more knowledgeable than me can look this over and let me know if anything is totally wacko.