Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.64 KB | None | 0 0
  1. #!/bin/bash
  2. # Script to manage reknro files
  3. #--------------------------------------------------------------------------------1
  4. # 1.Download all new files to a temp directory
  5. # -nc = no clobber (skip existing files), -t = retries, -o = output log file, -P = target directory
  6. wget -nc -t 3 -o /home/viliny/reknro/reknrolog.log --user=as1ftp --password='tuzky257' -P /home/viliny/reknro/temp/ ftp://62.142.123.227/Assistor/reknro*
  7. #--------------------------------------------------------------------------------2
  8. # 2. Move temp folder files to a datestamped directory
  9. # Create directory if it doesn't exist
  10. [ ! -d /home/viliny/reknro/$(date +"%m-%y") ] && mkdir -p /home/viliny/reknro/$(date +"%m-%y")
  11. # Move files to the directory
  12. if [ "$(ls -A /home/viliny/reknro/temp/)" ]; then mv /home/viliny/reknro/temp/* /home/viliny/reknro/$(date +"%m-%y")/; else exit; fi
  13. #
  14. #--------------------------------------------------------------------------------3
  15. # 3. Upload all new files to the remote archive
  16. pushd /home/viliny/reknro/$(date +"%m-%y")
  17. wput --skip-existing -t 3 reknro* ftp://as1ftp:tuzky257@62.142.123.227/Assistor/downloaded/
  18. popd
  19. #--------------------------------------------------------------------------------4
  20. # 4. Delete original files from server
  21. # NOT IN USE DURING TESTING
  22. #--------------------------------------------------------------------------------5
  23. # 5. Upload new files to inbox on server for processing into the system
  24. pushd /home/viliny/reknro/$(date +"%m-%y")
  25. wput -t 3 reknro* ftp://as1ftp:tuzky257@62.142.123.227/AKEAssi/Reknro/
  26. popd
  27. #--------------------------------------------------------------------------------END
  28. # END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement