BakirovRoman

git hook pre-push for ftp upload

Aug 28th, 2021 (edited)
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.51 KB | None | 0 0
  1. #!/bin/sh
  2. # sudo apt-get install git lftp # xfce4-notifyd # notify-osd
  3. HOST="cgi.server.ru"
  4. USERNAME="ftp0_username"
  5. PASSWORD="verySecret123Pwd"
  6. changed_files=$(git diff main origin/main --name-status)
  7. ftp_result=$(lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev ./ ./domains/your-domain.com/html --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/ --exclude vendor/ --exclude .idea/")
  8. # notify-send "FTP Result" "$changed_files $ftp_result" # --icon="/var/www/maria/ftp.jpg"
Add Comment
Please, Sign In to add comment