Guest User

Untitled

a guest
Aug 12th, 2016
138
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Rsync Jobs ###
  2. # schedule regualar syncs on linux machine from shared windows drive
  3. LOGPATH=/lhome/zabutko/rsync.log
  4. date >> $LOGPATH
  5.  
  6. # if rsync is already running, skip this sync session
  7. if ps -A | grep rsync ;
  8. then
  9. echo "rsync processes running.. skipping sync" >> $LOGPATH
  10. else
  11. echo "No rsync running yet. Beginning scheduled rsync jobs" >> $LOGPATH
  12.  
  13. echo "checking NTG6 mount"
  14. if mount | grep /mnt/ntg6 >> /dev/null ;
  15. then
  16. echo "NTG6 mounted correctly" >> $LOGPATH
  17. else
  18. echo "NTG6 not mounted. Mounting.." >> $LOGPATH
  19. mount -t cifs //network.drive/ /mnt/ntg6 -o credentials=/mnt/cred
  20. # credentials file has form:
  21. # username=zabutko
  22. # password=password
  23. # domain=AMERICAS
  24. if mount | grep /mnt/ntg6
  25. then echo "NTG6 mounted correctly" >> $LOGPATH
  26. else echo "could not mount ntg6" >> $LOGPATH
  27. fi
  28. fi
  29. if mount | grep /mnt/ntg6 >> /dev/null ;
  30. then
  31. rsync -avrzh --progress --exclude-from '/share/ntg6-exclude-list.txt' --delete-excluded /mnt/ntg6/HAR_INT/ /share/ntg6/ >> $LOGPATH
  32. # excluded-from has format
  33. # /31*
  34. # /40*
  35. # E00*
  36. # E010*
  37. fi
  38.  
  39.  
  40. echo "checking NTG55 mount" >> $LOGPATH
  41. if mount | grep /mnt/ntg55 >> /dev/null;
  42. then
  43. echo "NTG55 mounted correctly" >> $LOGPATH
  44. else
  45. echo "NTG55 not mounted. Mounting.." >> $LOGPATH
  46. mount -t cifs //network.drive/ /mnt/ntg55 -o credentials=/mnt/cred
  47. if mount | grep /mnt/ntg55 ;
  48. then echo "NTG55 mounted correctly" >> $LOGPATH
  49. else echo "could not mount ntg55" >> $LOGPATH
  50. fi
  51. fi
  52. if mount | grep /mnt/ntg55 >> /dev/null ;
  53. then
  54. rsync -avrzh --progress --exclude-from '/share/ntg55-exclude-list.txt' --delete-excluded /mnt/ntg55/ /share/ntg55 >> $LOGPATH
  55. fi
  56. fi
  57. echo "Job finished" >> $LOGPATH
  58. date >> $LOGPATH
RAW Paste Data