Fix database name fetch bug.
This commit is contained in:
parent
acbb318569
commit
03d88af847
|
@ -74,7 +74,11 @@ else
|
||||||
echo "root_path: $root_path";
|
echo "root_path: $root_path";
|
||||||
db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"`
|
db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"`
|
||||||
if [ -z $db_name ]; then
|
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
|
fi
|
||||||
echo "Database name: $db_name";
|
echo "Database name: $db_name";
|
||||||
date_str=`date "+%Y%m%d"`
|
date_str=`date "+%Y%m%d"`
|
||||||
|
|
|
@ -78,7 +78,11 @@ else
|
||||||
echo "root_path: $root_path";
|
echo "root_path: $root_path";
|
||||||
db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"`
|
db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"`
|
||||||
if [ -z $db_name ]; then
|
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
|
fi
|
||||||
echo "Database name: $db_name";
|
echo "Database name: $db_name";
|
||||||
date_str=`date "+%Y%m%d"`
|
date_str=`date "+%Y%m%d"`
|
||||||
|
|
Loading…
Reference in New Issue