Advertisement
Guest User

Bash script

a guest
Jun 10th, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 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=USERNAME --password='PASSWORD' -P /home/viliny/reknro/temp/ ftp://000.000.000.000/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. mv /home/viliny/reknro/temp/* /home/viliny/reknro/$(date +"%m-%y")/
  13. #--------------------------------------------------------------------------------3
  14. # 3. Upload all new files to the remote archive
  15. pushd /home/viliny/reknro/$(date +"%m-%y")
  16. wput --skip-existing -t 3 reknro* ftp://USERNAME:PASSWORD@000.000.000.000/Assistor/downloaded
  17. popd
  18. #--------------------------------------------------------------------------------4
  19. # 4. Delete original files from server
  20. # NOT IN USE DURING TESTING
  21. #--------------------------------------------------------------------------------5
  22. # 5. Upload new files to inbox on server for processing into the system
  23. pushd /home/viliny/reknro/$(date +"%m-%y")
  24. wput --skip-existing -t 3 reknro* ftp://USERNAME:PASSWORD@000.000.000.000/AKEAssi/Reknro/
  25. popd
  26. #--------------------------------------------------------------------------------END
  27. # END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement