deploy.sh 881 B

1234567891011121314151617181920212223
  1. # nohup socat -v tcp-listen:12345,fork,reuseaddr tcp:192.168.0.137:22 &
  2. # rsync -e `ssh -p 60$2` -avR --delete --progress bin/ ./bin data/ ./data/ shell ./shell/ cfg/ ./cfg/ root@10.8.0.$1:/program/ctnd/
  3. echo "Creating /program directory on 10.8.0.$1 192.168.8.$2"
  4. ssh -p 60$2 root@10.8.0.$1 "mkdir -p /program;"
  5. echo "Copying files to 10.8.0.$1 192.168.8.$2"
  6. rsync -e 'ssh -p 60'$2 -avzR --update --progress bin/ ./bin data/ ./data/ shell ./shell/ cfg/ ./cfg/ root@10.8.0.$1:/program/ctnd/
  7. if [ ! -z "$3" ];
  8. then
  9. echo "Deploying service"
  10. ssh -p 60$2 root@10.8.0.$1 "cd /program/ctnd/shell; ./service_deploy.sh $3; ./clean_local.sh;"
  11. else
  12. read -p "Restart ctnd (YyNn) ? " -n 1 -r
  13. echo # (optional) move to a new line
  14. if [[ $REPLY =~ ^[Yy]$ ]]
  15. then
  16. ssh root@10.8.0.$1 "systemctl restart sta"
  17. else
  18. echo "ctnd not restarted"
  19. fi
  20. fi