Skip to content

Instantly share code, notes, and snippets.

@Raphy
Created April 4, 2015 13:50
Show Gist options
  • Save Raphy/70dba18014e87f391f64 to your computer and use it in GitHub Desktop.
Save Raphy/70dba18014e87f391f64 to your computer and use it in GitHub Desktop.
Symfony Tool Script : Clear the cache quickly
#!/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