Created
September 3, 2013 16:07
-
-
Save moux2003/6425951 to your computer and use it in GitHub Desktop.
Set permissions
This file contains hidden or 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/sh | |
| if [ -d app/cache ]; then rm -rf app/cache/*; fi | |
| if [ -d app/logs ]; then rm -rf app/logs/*; fi | |
| if [ -d app/spool ]; then rm -rf app/spool/*; fi | |
| # source : https://raw.github.com/everzet/dotfiles/master/scripts/chcache | |
| USER=$(whoami) | |
| APACHE_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}') | |
| chcache () { | |
| sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx $1 | |
| sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx $1 | |
| echo "- $1 has been properly chmod'ed for $USER and $APACHE_USER" | |
| } | |
| # Symfony2 | |
| if [ -d app/cache ]; then chcache "app/cache"; fi | |
| if [ -d app/logs ]; then chcache "app/logs"; fi | |
| if [ -d app/spool ]; then chcache "app/spool"; fi | |
| if [ -d web/uploads ]; then chcache "web/uploads"; fi | |
| if [ -d web/media ]; then chcache "web/media"; fi | |
| if [ -d web/images ]; then chcache "web/images"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment