Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.65 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
  13.    mv /home/viliny/reknro/temp/* /home/viliny/reknro/$(date +"%m-%y")/
  14. else
  15.     exit
  16. fi
  17. #
  18. #--------------------------------------------------------------------------------3
  19. # 3. Upload all new files to the remote archive
  20. pushd /home/viliny/reknro/$(date +"%m-%y")
  21. wput --skip-existing -t 3 reknro* ftp://as1ftp:tuzky257@62.142.123.227/Assistor/downloaded
  22. popd
  23. #--------------------------------------------------------------------------------4
  24. # 4. Delete original files from server
  25. # NOT IN USE DURING TESTING
  26. #--------------------------------------------------------------------------------5
  27. # 5. Upload new files to inbox on server for processing into the system
  28. pushd /home/viliny/reknro/$(date +"%m-%y")
  29. wput -t 3 reknro* ftp://as1ftp:tuzky257@62.142.123.227/AKEAssi/Reknro/
  30. popd
  31. #--------------------------------------------------------------------------------END
  32. # END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement