-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.sh
More file actions
19 lines (12 loc) · 700 Bytes
/
Copy pathsync.sh
File metadata and controls
19 lines (12 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
## This script syncs data between hpc and web server
## HPC:/home/wwwsync/output -> WEB:/home/hpc/input
## WEB:/home/hpc/ouput -> HPC:/home/wwwsync/input
## Execute every hour or xx:55 by root
NOW=$(date +"%Y%m%d")
echo "=====================================================" >> /home/wwwsync/log_sync/"$NOW.sync.record"
echo "$(date +"%Y%m%d%H%M")" >> /home/wwwsync/log_sync/"$NOW.sync.record"
# sync to remote
rsync -avzh --delete /home/wwwsync/output/ hpc@140.122.63.103:/home/hpc/input/ >> /home/wwwsync/log_sync/"$NOW.sync.record"
# sync from remote
rsync -avzh --delete hpc@140.122.63.103:/home/hpc/output/ /home/wwwsync/input/ >> /home/wwwsync/log_sync/"$NOW.sync.record"