Fix database name fetch bug.
This commit is contained in:
parent
acbb318569
commit
03d88af847
|
@ -73,9 +73,13 @@ else
|
|||
root_path=`$ssh_command "cat '$nginx_file'|grep -E '(^|^\s+)root'|sed -E 's/(^|^\s+)root\s+//'|tr ';' ' '|awk '{print \\$1}'|sed 's/\/public$//g'|xargs|awk '{print \\$1}'"`;
|
||||
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
|
||||
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"`
|
||||
mongo_output="$root_path/dump_$date_str"
|
||||
|
|
|
@ -77,9 +77,13 @@ else
|
|||
root_path=`$ssh_command "cat '$nginx_file'|grep -E '(^|^\s+)root'|sed -E 's/(^|^\s+)root\s+//'|tr ';' ' '|awk '{print \\$1}'|sed 's/\/public$//g'|xargs|awk '{print \\$1}'"`;
|
||||
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
|
||||
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"`
|
||||
mongo_output="$root_path/dump_$date_str"
|
||||
|
|
Loading…
Reference in New Issue