-
#!/bin/bash
-
###################################################
-
#@name :zcfx_execdata_99_to_103.sh
-
#@caption :将99上的csv文件发送到103主机,并调用103上导入neo4j脚本;
-
#@AUTHOR :yzg
-
#@create-date 2020-12-15
-
#@mender
-
#@modify_desc
-
###################################################
-
-
#set enviorment
-
export LANG=en_US.utf8
-
-
#shell_path="/root/zcfx_neo4j_data/shell"
-
#shell_name='zcfx_execdata_99_to_103.sh'
-
data_path=
'/root/zcfx_neo4j_data/data/'
-
log_path=
"/root/zcfx_neo4j_data/log/"
-
date_time=log_
"`date +%Y%m%d%H%M`"
-
bak_path=
'/root/zcfx_neo4j_data/bak/'
-
cd
${data_path}
-
if [ $? -eq 0 ];
then
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"切换文件夹成功!"
${data_path}>
${log_path}
${date_time}
-
rm
${bak_path}/*.csv
-
if [ $? -eq 0 ];
then
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"bak内文件夹删除成功!">>
${log_path}
${date_time}
-
cp *.csv
${bak_path}
-
if [ $? -eq 0 ];
then
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"文件备份到bak文件夹成功!"
-
scp *.csv 192.168.60.103:///zybtp/neo4j/neo4j-community-3.4.5/import
-
if [ $? -eq 0 ];
then
-
rm *.csv
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"数据scp发送成功!">>
${log_path}
${date_time}
-
ssh root@192.168.60.103 > /dev/null 2>&1 << eeooff
-
cd /root
-
sh zcfx-import-graph.sh
-
exit
-
eeooff
-
else
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"数据scp发送失败!">>
${log_path}
${date_time}
-
fi
-
else
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"文件备份到bak文件夹失败!">>
${log_path}
${date_time}
-
fi
-
else
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"bak内文件夹删除失败!">>
${log_path}
${date_time}
-
fi
-
-
echo
"neo4j import data script done!">>
${log_path}
${date_time}
-
else
-
echo `date +
"%Y-%m-%d %H:%M:%S"`
"切换文件夹失败!"
${data_path}>
${log_path}
${date_time}
-
fi
-
转载:https://blog.csdn.net/yezonggang/article/details/113932823
查看评论