You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init_benchmark.sh 882B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. function clearCacheAndLogs() {
  3. sudo /bin/rm -rf var/cache/*
  4. [ "$?" != "0" ] && exit 1
  5. sudo /bin/chmod -R 777 var/cache
  6. [ "$?" != "0" ] && exit 1
  7. sudo /bin/rm -rf var/log/*
  8. [ "$?" != "0" ] && exit 1
  9. sudo /bin/chmod -R 777 var/log
  10. [ "$?" != "0" ] && exit 1
  11. }
  12. function init() {
  13. local type=$1
  14. if [ "$type" == "1" ]; then
  15. env="helloworld";
  16. elif [ "$type" == "2" ]; then
  17. env="news";
  18. else
  19. env="rest"
  20. fi
  21. clearCacheAndLogs
  22. export APP_ENV=$env
  23. composer install --no-dev --optimize-autoloader
  24. [ "$?" != "0" ] && exit 1
  25. if [ "$env" == "news" ]; then
  26. php app/console assets:install --symlink --env=$env
  27. [ "$?" != "0" ] && exit 1
  28. php app/console assetic:dump --env=$env
  29. [ "$?" != "0" ] && exit 1
  30. fi
  31. clearCacheAndLogs
  32. return 0
  33. }