четверг, 25 сентября 2014 г.

Text replace recursively in files

$ grep 'text for replace' -P -R -I -l  * | xargs sed -i 's/regexp1/regexp2/g'

$find path -print0 | xargs -0 sed -i 's/regexp1/regexp2/g'

         $ find . -type f -print0 | xargs -0 perl -i -pe 's/regexp/some/g'


         $find -type f -name \*.py -exec sed -i -r 's/regexp1/regexp2/g' {} \;

вторник, 23 сентября 2014 г.

Restarting php-fpm

  • Using SysV Init scripts directly:
    /etc/init.d/php-fpm restart    # typical
    /etc/init.d/php5-fpm restart   # debian-style
    
  • Using service wrapper script
    service php-fpm restart    # typical
    service php5-fpm restart   # debian-style
    
  • Using Upstart (e.g. ubuntu):
    restart php5-fpm           # typical (ubuntu is debian-based)
    restart php-fpm            # uncommon
    
  • Using systemd (newer servers):
    systemctl restart php-fpm.service    # typical
    systemctl restart php5-fpm.service   # uncommon