v-update-web-templates 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. # info: updates web templates
  3. # options: [RESTART]
  4. #
  5. # The function for obtaining updated pack of web templates.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. restart=$1
  11. # Includes
  12. source $VESTA/conf/vesta.conf
  13. source $VESTA/func/main.sh
  14. #----------------------------------------------------------#
  15. # Action #
  16. #----------------------------------------------------------#
  17. # Get new archive
  18. tmpdir=$(mktemp -d --dry-run)
  19. mkdir $tmpdir
  20. cd $tmpdir
  21. wget http://c.vestacp.com/0.9.8/rhel/templates.tar.gz -q
  22. if [ "$?" -ne 0 ]; then
  23. echo "Error: can't download template.tar.gz"
  24. log_event "$E_CONNECT" "$EVENT"
  25. rm -rf $tmpdir
  26. exit $E_CONNECT
  27. fi
  28. # Update templates
  29. tar -xzpf templates.tar.gz -C $VESTA/data/ templates/web
  30. # Rebuild web domains
  31. for user in $($BIN/v-list-sys-users plain); do
  32. $BIN/v-rebuild-web-domains $user no
  33. done
  34. #----------------------------------------------------------#
  35. # Vesta #
  36. #----------------------------------------------------------#
  37. # Restart web server
  38. if [ "$restart" != 'no' ]; then
  39. $BIN/v-restart-web
  40. $BIN/v-restart-proxy
  41. fi
  42. # Delete tmpdir
  43. rm -rf $tmpdir
  44. exit