update.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. [ -e /root/bityuan ] && [ -e /root/chain33 ] && echo "bityuan exist. please rename or backup bityuan first. package will install to bityuan" && exit 0
  2. [ ! -e /root/chain33 ] && [ ! -e /root/bityuan ] && curl -sSLf https://dev.33.cn/linj/installChain33/raw/master/install_and_dumpkey.sh | sh && exit 0
  3. [ -e /etc/supervisor/conf.d/chain33.conf ] && supervisorctl stop chain33
  4. [ -e /etc/supervisor/conf.d/bty.conf ] && supervisorctl stop bty
  5. [ -e /etc/supervisor/conf.d/chain33.conf ] && rm /etc/supervisor/conf.d/chain33.conf
  6. [ -e /root/chain33 ] && mv /root/chain33 /root/bityuan
  7. cd /tmp/
  8. [ -e /tmp/chain33 ] && rm /tmp/chain33 -rf
  9. [ -e /tmp/bityuan ] && rm /tmp/bityuan -rf
  10. [ -e /tmp/bityuan_ubuntu.tgz ] && rm /tmp/bityuan_ubuntu.tgz
  11. cd /tmp/
  12. wget https://old.bityuan.com/download/bityuan_ubuntu.tgz
  13. tar zxf bityuan_ubuntu.tgz
  14. cd bityuan
  15. [ -e bityuan ] && install bityuan /root/bityuan/bityuan
  16. [ -e bityuan-cli ] && install bityuan-cli /root/bityuan/bityuan-cli
  17. [ -e bityuan.toml ] && install bityuan.toml /root/bityuan/bityuan.toml
  18. [ -e bty ] && install bty /root/bityuan/bty
  19. [ -e bty.conf ] && install bty.conf /etc/supervisor/conf.d/bty.conf
  20. cd ~/bityuan
  21. rm -rf bityuan.toml
  22. wget https://dev.33.cn/xs/installChain33/raw/master/bityuan.toml
  23. supervisorctl reload
  24. sleep 15
  25. set -x
  26. started=`ps aux | grep bityuan -w | grep -v grep | wc -l`
  27. [ $started = 1 ] || supervisorctl restart bty
  28. sleep 15
  29. started=`ps aux | grep bityuan -w | grep bityuan.toml | grep -v grep | wc -l`
  30. [ $started = 1 ] && echo "update bityuan success!"
  31. [ $started != 1 ] && echo "update bityuan failed!"