swap_addons_live_stage.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. ## save the curent 'addons-old'... will use this later
  3. #mv /data/mxr-data/addons-old /data/mxr-data/addons-next-stage
  4. ## These are basically instant
  5. #mv /data/mxr-data/addons /data/mxr-data/addons-old
  6. #mv /data/mxr-data/addons-stage /data/mxr-data/addons
  7. ## at this point, there is no addons-stage... take the 'old' tree and make it the new stage
  8. #mv /data/mxr-data/addons-next-stage /data/mxr-data/addons-stage
  9. #rsync -av --delete --exclude=/addons /data/mxr-data/addons/ /data/mxr-data/addons-stage
  10. #rm -rf /data/mxr-data/addons-stage/addons # (should be unnecessary, unless exclude messes us up)
  11. #mkdir /data/mxr-data/addons-stage/addons
  12. cd /var/www/webtools/mxr
  13. # Clean out stage
  14. rm -rf /data/mxr-data/addons-stage/addons # should already be empty
  15. mkdir /data/mxr-data/addons-stage/addons
  16. # Run the update against stage - *NOT* update-full-onetree.sh
  17. OUT1=`perl update-src.pl -cron addons-stage 2>&1`
  18. # Swap stage into live
  19. mv /data/mxr-data/addons/addons /data/mxr-data/addons/addons-old
  20. mv /data/mxr-data/addons-stage/addons /data/mxr-data/addons/addons
  21. rm -rf /data/mxr-data/addons/addons-old &
  22. # xref and index on live, so that the paths are correct
  23. OUT2=`perl update-xref.pl -cron addons 2>&1`
  24. OUT3=`perl update-search.pl -cron addons 2>&1`
  25. if [ -n "$OUT1" ] || [ -n "$OUT2" ] || [ -n "$OUT3" ]; then
  26. echo "Updating addons..."
  27. echo "$OUT1"
  28. echo "$OUT2"
  29. echo "$OUT3"
  30. fi
  31. wait