deploy-to-ovh.sh 479 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. echo 'Deploy website through FTP'
  3. : "{FTP_HOST:?FTP_HOST not set or empty}"
  4. : "{FTP_USER:?FTP_USER not set or empty}"
  5. : "{FTP_PORT:=21}"
  6. : "{FTP_DEST:=www}"
  7. : "{DIST_DIR:=dist}"
  8. files=`find $DIST_DIR -type f`
  9. echo 'Files to be sent :'
  10. echo "$files"
  11. echo "FTP to $FTP_HOST"
  12. read -s -p "[deploy] password for $FTP_USER: " password
  13. echo
  14. # ftp operation
  15. ftp -pvin $FTP_HOST $FTP_PORT<<EOT
  16. user $FTP_USER $password
  17. nmap $DIST_DIR\$1 $FTP_DEST/\$1
  18. mput $files
  19. bye
  20. EOT