diff --git a/move_site.sh b/move_site.sh index 6b507d4..18de9d3 100644 --- a/move_site.sh +++ b/move_site.sh @@ -74,7 +74,11 @@ else echo "root_path: $root_path"; db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"` if [ -z $db_name ]; then - exit_command 1; + mongo_uri=`$ssh_command "grep -w 'uri:' '$root_path/config/mongoid.yml' -m1|sed 's/uri://g'| xargs"` + db_name=`basename "$mongo_uri"|cut -d '?' -f1` + if [ -z $db_name ]; then + exit_command 1; + fi fi echo "Database name: $db_name"; date_str=`date "+%Y%m%d"` diff --git a/move_site_interactive.sh b/move_site_interactive.sh index 1552d9e..9a3bbe4 100644 --- a/move_site_interactive.sh +++ b/move_site_interactive.sh @@ -78,7 +78,11 @@ else echo "root_path: $root_path"; db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"` if [ -z $db_name ]; then - exit_command 1; + mongo_uri=`$ssh_command "grep -w 'uri:' '$root_path/config/mongoid.yml' -m1|sed 's/uri://g'| xargs"` + db_name=`basename "$mongo_uri"|cut -d '?' -f1` + if [ -z $db_name ]; then + exit_command 1; + fi fi echo "Database name: $db_name"; date_str=`date "+%Y%m%d"`