小言_互联网的博客

shell备忘--20210222

374人阅读  评论(0)

  
  1. #!/bin/bash
  2. ###################################################
  3. #@name :zcfx_execdata_99_to_103.sh
  4. #@caption :将99上的csv文件发送到103主机,并调用103上导入neo4j脚本;
  5. #@AUTHOR :yzg
  6. #@create-date 2020-12-15
  7. #@mender
  8. #@modify_desc
  9. ###################################################
  10. #set enviorment
  11. export LANG=en_US.utf8
  12. #shell_path="/root/zcfx_neo4j_data/shell"
  13. #shell_name='zcfx_execdata_99_to_103.sh'
  14. data_path= '/root/zcfx_neo4j_data/data/'
  15. log_path= "/root/zcfx_neo4j_data/log/"
  16. date_time=log_ "`date +%Y%m%d%H%M`"
  17. bak_path= '/root/zcfx_neo4j_data/bak/'
  18. cd ${data_path}
  19. if [ $? -eq 0 ]; then
  20. echo `date + "%Y-%m-%d %H:%M:%S"` "切换文件夹成功!" ${data_path}> ${log_path} ${date_time}
  21. rm ${bak_path}/*.csv
  22. if [ $? -eq 0 ]; then
  23. echo `date + "%Y-%m-%d %H:%M:%S"` "bak内文件夹删除成功!">> ${log_path} ${date_time}
  24. cp *.csv ${bak_path}
  25. if [ $? -eq 0 ]; then
  26. echo `date + "%Y-%m-%d %H:%M:%S"` "文件备份到bak文件夹成功!"
  27. scp *.csv 192.168.60.103:///zybtp/neo4j/neo4j-community-3.4.5/import
  28. if [ $? -eq 0 ]; then
  29. rm *.csv
  30. echo `date + "%Y-%m-%d %H:%M:%S"` "数据scp发送成功!">> ${log_path} ${date_time}
  31. ssh root@192.168.60.103 > /dev/null 2>&1 << eeooff
  32. cd /root
  33. sh zcfx-import-graph.sh
  34. exit
  35. eeooff
  36. else
  37. echo `date + "%Y-%m-%d %H:%M:%S"` "数据scp发送失败!">> ${log_path} ${date_time}
  38. fi
  39. else
  40. echo `date + "%Y-%m-%d %H:%M:%S"` "文件备份到bak文件夹失败!">> ${log_path} ${date_time}
  41. fi
  42. else
  43. echo `date + "%Y-%m-%d %H:%M:%S"` "bak内文件夹删除失败!">> ${log_path} ${date_time}
  44. fi
  45. echo "neo4j import data script done!">> ${log_path} ${date_time}
  46. else
  47. echo `date + "%Y-%m-%d %H:%M:%S"` "切换文件夹失败!" ${data_path}> ${log_path} ${date_time}
  48. fi

 


转载:https://blog.csdn.net/yezonggang/article/details/113932823
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场