Advertisement
Guest User

Untitled

a guest
Oct 10th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #scripts for backup
  2. #sripts prepared by dhafer abudarag86348@gmail.com
  3. #!/bin/bash
  4. date=$(date +"%Y%m")
  5. /usr/bin/expect<<EOF
  6. cd /home/mdsp/lcftp/templc/sag/sa/run/sa/10.157.78.40
  7. spawn bash -c "/usr/bin/scp *$date*.log root@10.157.78.143:/tmp/dhafer"
  8. expect "Password:"
  9. send "Zain@123r"
  10. expect eof
  11. EOF
  12.  
  13. #scripts for backup
  14. #sripts prepared by dhafer 0592996292 abudarag86348@gmail.com
  15. #!/bin/bash
  16. DATE=$(date +"%Y%m")
  17. HOST=10.157.78.143
  18. PORT=22
  19. USER=root
  20. PASSWORD=Zain@123
  21. SOURCE_FILE=/home/mdsp/lcftp/templc/sag/sa/run/sa/10.157.78.40/*$DATE*
  22. TARGET_DIR=/tmp/dhafer
  23. /usr/bin/expect<<EOD
  24. spawn /usr/bin/sftp -o Port=$PORT $USER@$HOST
  25. expect "password:"
  26. send "$PASSWORDr"
  27. expect "sftp>"
  28. send "put $SOURCE_FILE $TARGET_DIRr"
  29. expect "sftp>"
  30. send "byer"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement