Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Rsync Jobs ###
- # schedule regualar syncs on linux machine from shared windows drive
- LOGPATH=/lhome/zabutko/rsync.log
- date >> $LOGPATH
- # if rsync is already running, skip this sync session
- if ps -A | grep rsync ;
- then
- echo "rsync processes running.. skipping sync" >> $LOGPATH
- else
- echo "No rsync running yet. Beginning scheduled rsync jobs" >> $LOGPATH
- echo "checking NTG6 mount"
- if mount | grep /mnt/ntg6 >> /dev/null ;
- then
- echo "NTG6 mounted correctly" >> $LOGPATH
- else
- echo "NTG6 not mounted. Mounting.." >> $LOGPATH
- mount -t cifs //network.drive/ /mnt/ntg6 -o credentials=/mnt/cred
- # credentials file has form:
- # username=zabutko
- # password=password
- # domain=AMERICAS
- if mount | grep /mnt/ntg6
- then echo "NTG6 mounted correctly" >> $LOGPATH
- else echo "could not mount ntg6" >> $LOGPATH
- fi
- fi
- if mount | grep /mnt/ntg6 >> /dev/null ;
- then
- rsync -avrzh --progress --exclude-from '/share/ntg6-exclude-list.txt' --delete-excluded /mnt/ntg6/HAR_INT/ /share/ntg6/ >> $LOGPATH
- # excluded-from has format
- # /31*
- # /40*
- # E00*
- # E010*
- fi
- echo "checking NTG55 mount" >> $LOGPATH
- if mount | grep /mnt/ntg55 >> /dev/null;
- then
- echo "NTG55 mounted correctly" >> $LOGPATH
- else
- echo "NTG55 not mounted. Mounting.." >> $LOGPATH
- mount -t cifs //network.drive/ /mnt/ntg55 -o credentials=/mnt/cred
- if mount | grep /mnt/ntg55 ;
- then echo "NTG55 mounted correctly" >> $LOGPATH
- else echo "could not mount ntg55" >> $LOGPATH
- fi
- fi
- if mount | grep /mnt/ntg55 >> /dev/null ;
- then
- rsync -avrzh --progress --exclude-from '/share/ntg55-exclude-list.txt' --delete-excluded /mnt/ntg55/ /share/ntg55 >> $LOGPATH
- fi
- fi
- echo "Job finished" >> $LOGPATH
- date >> $LOGPATH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement