Advertisement
cheungtifan

Untitled

May 6th, 2012
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. [L:h3cstor] /opt/mirror# cat _commonvar
  2. RSYNC=/usr/bin/rsync
  3. PATH=/usr/local/bin:/usr/bin:/bin
  4. PIDPREFIX=/tmp
  5. LOGPATH=/var/log
  6. MIRRORROOT=/export/mirror
  7. [L:h3cstor] /opt/mirror# cat daily
  8. #!/bin/sh
  9. # Load common varables for mirroring
  10. . /opt/mirror/_commonvar
  11. RSYNC_OPTIONS="-a --delete --safe-links"
  12.  
  13. [L:h3cstor] /opt/mirror# cat  frequently
  14. #!/bin/bash
  15. # Load common varables for mirroring
  16. . /opt/mirror/_commonvar
  17. RSYNC_OPTIONS="-a --delete --safe-links --timeout=10"
  18.  
  19. # CPAN
  20. if [ -f ${PIDPREFIX}/cpan.pid ] ; then
  21.         if [ -d /proc/`cat ${PIDPREFIX}/cpan.pid` ] ; then
  22.                 kill `cat ${PIDPREFIX}/cpan.pid`
  23.         fi
  24.         rm ${PIDPREFIX}/cpan.pid
  25. fi
  26. ${RSYNC} ${RSYNC_OPTIONS} rsync://cpan-rsync.perl.org/CPAN/ ${MIRRORROOT}/CPAN/ &
  27. echo $! > ${PIDPREFIX}/cpan.pid
  28.  
  29. sleep 600
  30.  
  31. # CTAN
  32. if [ -f ${PIDPREFIX}/ctan.pid ] ; then
  33.         if [ -d /proc/`cat ${PIDPREFIX}/ctan.pid` ] ; then
  34.                 kill `cat ${PIDPREFIX}/ctan.pid`
  35.         fi
  36.         rm ${PIDPREFIX}/ctan.pid
  37. fi
  38. ${RSYNC} ${RSYNC_OPTIONS} rsync://rsync.tug.ctan.org/CTAN ${MIRRORROOT}/CTAN/ &
  39. echo $! > ${PIDPREFIX}/ctan.pid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement