Archive for October 26th, 2009
Search in files and replace by bash
by z3n on Oct.26, 2009, under Coding, Linux Happyness, Tips & Hints
Problem:
How to change a string on several files by bash without opening one by one.
Solution:
for i in $(find . -type f); do sed ’s/find/replace/g’ $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
Yes, it’s just a copy paste from the source, i don’t have time to explain each command.
Source:
Things you will forget when migrating to a new server
by z3n on Oct.26, 2009, under Linux Happyness
When migrating to a new server you will forget to:
- Check php session folder pemissions (/var/lib/php/session/ this folder must be writable)
- Do a DNS reverse setup, and will only notice when emails start to bounce.
- To configure dovecot you need to enable the protocols AND make sure it’s listening to internet as well (webmin configuration is ambiguous and bugged, you should edit the conf file manually)
- To add ALL old users BEFORE doing the file copy
- To add a trailing slash (/) when doing rsync file copy, which will generate /home/user/home/user/ instead of /home/user/
- To check server’s firewall before starting apache and wondering why nothing is working.
- When setting up a new nameserver, you always tend to ignore “.org, .net, .com only” which might cause lots of headaches later, when you realize that ns will not work, after changing 100 domains.