upload_to_ftp.sh 884 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # 定义tplay根路径
  3. webroot="/mnt/web/backend.tplay.com"
  4. # 配置ftp
  5. host="127.0.0.1"
  6. user="xxxxxx"
  7. pwd="xxxxxx"
  8. port="21"
  9. ftproot="/"
  10. su -c "php ${webroot}/public/index.php admin/catalog/exportHtml" -s /bin/sh www
  11. # 创建webUpdate目录
  12. rm -rf ${webroot}/public/uploads/webUpdate/*
  13. su -c "mkdir -p ${webroot}/public/uploads/webUpdate" -s /bin/sh www
  14. # 复制q1464674022目录中一天内更新的文件到webUpdate目录
  15. rm -f ${webroot}/public/uploads/webUpdate.gz
  16. cd ${webroot}/public/uploads/q1464674022
  17. find ./ -mtime -1 -type f |xargs tar -zcvf ${webroot}/public/uploads/webUpdate.gz > /dev/null
  18. su -c "tar -zxvf ${webroot}/public/uploads/webUpdate.gz -C ${webroot}/public/uploads/webUpdate" -s /bin/sh www
  19. # 上传覆盖远程ftp
  20. /usr/local/ncftp/bin/ncftpput -m -R -u ${user} -p ${pwd} -P ${port} ${host} ${ftproot} ${webroot}/public/uploads/webUpdate/*