Sunday, May 24, 2009

Searching for a pattern string under a directory

In order to search for a pattern string in all files under a specific directory you can use following command:
find $dir -exec grep $pattern {} \; -print
just replace $dir with the directory you want to start searching in and $patter with patter you are searching for.
for example:
find /etc -exec grep support {} \; -print

Saturday, May 09, 2009

changing editor in ubuntu linux

To permanently change editor in Linux do following:
edit your shell configuration file,
for example, bash configuration file is ~/.bashrc
To set editor as VI:
export VISUAL=vi
or to set nano:
export VISUAL=nano
to start it run:
source ~/.bashrc

Sunday, April 12, 2009

Running manual NTP (network time protocol) In Ubuntu Linux

If your Ubuntu is out of time sync you can run a manual comand to syncronize the clock. command is:
ntpdate
Running ntpdate with no options / switches will couse it to try to sync with default servers. If none are set you will get an error similar to:
ntpdate[15110]: no servers can be used, exiting
then run it with servers address.
for example:
ntpdate europe.pool.ntp.org north-america.pool.ntp.org
you might need to run sudo if you are not system root:
sudo ntpdate europe.pool.ntp.org north-america.pool.ntp.org
P.S. Server pool for Israel is:
il.pool.ntp.org

Provided by:SiQ systems, Cloud experts

Monday, April 06, 2009

Fix (repair) MySQL replication in case of duplicate items

If you as i am using MySQL replication mechanism, master-slave or master-master replication you sometimes loose replication due to duplicate entries.

You can fix it by simply skipping the record:
1. log into MySQL:
mysql -u root -p
2. in MySQL shell stop slave replication
mysql> STOP SLAVE;
3. skip the affected record
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
4. start slave replication process
mysql> START SLAVE;
5. verify that replication is working:
mysql> SHOW SLAVE STATUS \G
6. exit MySQL shell:
mysql> quit;


Provided by:SiQ systems, Cloud experts