This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
centos_local_repo_rsync [2011/07/11 17:56] jt created |
centos_local_repo_rsync [2011/07/15 20:39] jt |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
- | |||
- | |||
<code bash> | <code bash> | ||
#!/bin/bash | #!/bin/bash | ||
Line 7: | Line 4: | ||
# name: centos-rsync | # name: centos-rsync | ||
# date: 20110711 | # date: 20110711 | ||
- | # author: jason thomas <jthomas@blip.tv> | + | # author: jason thomas <jason@lithiumfox.com> |
# purpose: update local centos mirror with remote centos mirror | # purpose: update local centos mirror with remote centos mirror | ||
Line 17: | Line 14: | ||
CURRENT6="6.0" | CURRENT6="6.0" | ||
- | if [ -f $LOCK ]; then | ||
- | exit 0 | ||
- | fi | ||
- | control_sigint(){ | + | sync_repo(){ |
- | unlink $LOCK | + | ( flock 200 |
- | exit $? | + | if [ -d $REPO/$@ ] ; then |
+ | rsync -avSHP --delete --exclude "local*" --exclude "isos" --exclude "i386" $MIRROR::CentOS/$@/ $REPO/$@/ | ||
+ | fi | ||
+ | ) 200>$LOCK$@ | ||
} | } | ||
- | trap control_sigint SIGINT | + | sync_repo $CURRENT5 & |
- | + | sync_repo $CURRENT6 & | |
- | if [ -d $REPO/$CURRENT5 ] ; then | + | |
- | touch $LOCK | + | |
- | rsync -avSHP --delete --exclude "local*" --exclude "isos" --exclude "i386" $MIRROR::CentOS/$CURRENT5/ $REPO/$CURRENT5/ | + | |
- | unlink $LOCK | + | |
- | fi | + | |
- | + | ||
- | if [ -d $REPO/$CURRENT6 ] ; then | + | |
- | touch $LOCK | + | |
- | rsync -avSHP --delete --exclude "local*" --exclude "isos" --exclude "i386" $MIRROR::CentOS/$CURRENT6/ $REPO/$CURRENT6/ | + | |
- | unlink $LOCK | + | |
- | fi | + | |
</code> | </code> |