Created
April 4, 2015 13:50
-
-
Save Raphy/70dba18014e87f391f64 to your computer and use it in GitHub Desktop.
Symfony Tool Script : Clear the cache quickly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Deleting the cache and logs | |
sudo rm -rf app/cache/* app/logs/*.log | |
# This previous line will only work if the current user has the right to execute the command as sudo | |
# Add into /etc/sudoers | |
# USER_NAME ALL = NOPASSWD: /bin/rm -rf app/cache/* app/logs/*.log | |
# Replace USER_NAME by the owner of the repository | |
app/console cache:clear | |
app/console cache:clear --env=prod | |
app/console cache:warmup | |
app/console cache:warmup --env=prod | |
touch app/logs/{prod,dev}.log | |
# These lines set the rights to the apache server | |
APACHE_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {if ($1) print $1}') | |
setfacl -R -m u:"$APACHE_USER":rwx app/cache app/logs/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment