RSS feed

Postfix: delete all MAILER-DAEMON mails

February 24th, 2009 | Posted in Blog, Linux, Postfix | No Comments


mailq | grep MAILER-DAEMON | awk '{print $1}' | tr -d '*' | postsuper -d —

Or


mailq | tail +2 | awk  'BEGIN { RS = "" } / MAILER-DAEMON/ { print $1}'|postsuper -d —


Counting up to the UNIX Epoch time reading 1,234,567,890!

February 9th, 2009 | Posted in Blog, Debian, FreeBSD, Linux | No Comments

Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds. It is widely used not only on Unix-like operating systems but also in many other computing systems. It is neither a linear representation of time nor a true representation of UTC (though it is frequently mistaken for both) as the times it represents are UTC but it has no way of representing UTC leap seconds (e.g. 1998-12-31 23:59:60).

“At 11:31:30pm UTC on Feb 13, 2009, Unix time will reach 1,234,567,890.

Where will you be at this momentous second?” – from Bell Labs

You can use the following perl command to find out when the Epoch time reading will be 123456789 in your time zone

perl -e 'print scalar localtime(1234567890),"\n";'


Travian

February 9th, 2009 | Posted in Blog, Linux | No Comments

Travian is a browser game with a world full of thousands of users who all begin as the leaders of small villages… you can wage wars with your enemies, trade with far far away exotic villages.. all from the comfort of your browser!

http://www.travian.co.uk/?uc=ukx_524

Signup today, new game just commenced!



MySQL Replication

February 8th, 2009 | Posted in Blog, Linux, MySQL | No Comments

MySQL database replication allows you to have an exact copy of a database on another server which allows you to setup an application to read from, i.e. auth.

All changes to the “master” server is replicated across to the “slave” server instantaneously. This is not a backup technique… any accidental DELETE queries on the master will well… see for yourself. Replication can however help against hardware failure.

On the master server, edit my.cnf and insert the following under the [mysqld] section:

##################################################
##  REPLICATION

log-bin
binlog-do-db=pdns
binlog-ignore-db=mysql
binlog-ignore-db=test

server-id=1

##################################################

The above will cause the database pdns to be replicated to our slave server and the mysql and test databases will be ignored. If you don’t need this, you can safely remove those lines. Additionally, you can specify to which file mysql should log the binary data. To do that, edit the file and set the log-bin directive to:

log-bin = /var/log/master-mysql-bin.log

Save the file and restart MySQL

/etc/init.d/mysqld restart

Next, connect to the MySQL CLI and add a user to be used for replication. The query below will do just fine for this.

GRANT REPLICATION SLAVE on *.* to 'replication'@172.16.0.30 identified by 'mypassword';
FLUSH PRIVILEGES;

SHOW MASTER STATUS;

Take note of of the file name and the log position, you will need to enter this information on the slave later on.

Next you need to grab the data from the master and import it on the slave system. Personally I prefer to just do a dump and import it at the slave, but there are other ways to accomplish this.

mysqldump -u root -p -e  pdns > pdns080209.sql

On the slave system, connect to the MySQL CLI and create the database

CREATE DATABASE pdns;

Next, setup the slave settings in my.cnf

##################################################
##  REPLICATION

server-id=2

master-host = 172.16.0.29
master-user = replication
master-password = mypassword
master-port = 3306

##################################################

Save and exit the file then import the dump you just created on the master

mysql pdns -u root -p < pdns080209.sql

Note! If the database is BIG, you will get errors, please refer to this post to get a workaround.

Once the database has been imported, restart the slave server, set the log file position and start the slave

/etc/init.d/mysqld restart
SLAVE STOP;
CHANGE MASTER TO MASTER_HOST=’172.16.0.29, MASTER_USER='replication', MASTER_PASSWORD='mypassword', MASTER_LOG_FILE='master-mysql-bin.001', MASTER_LOG_POS=73;
START SLAVE;

Next, ensure both Slave_IO_Running and Slave_SQL_Running are showing up as YES, and that’s it… your done.



PowerDNS 2.9.22 RPM’s

February 5th, 2009 | Posted in Linux, PowerDNS | No Comments

The latest (dynamic) RPM’s for PowerDNS can be downloaded below. Please note, these RPM’s only include the MySQL and pipe backend!

 

pdns-2.9.22-1.i386.src.rpm

pdns-2.9.22-1.i386.rpm



Grep Highlighting

January 23rd, 2009 | Posted in Linux | No Comments

If you’ve ever wanted your search string highlighted when grepping through masses of logs etc you can add the following alias to ~/bashrc to do just this.

 

alias grep='grep --color=auto'


PowerDNS 2.9.21-2 RPM's

January 17th, 2009 | Posted in Linux, PowerDNS | No Comments

The latest (dynamic) RPM’s for PowerDNS can be downloaded below. Please note, these RPM’s only include the MySQL and pipe backend!

 

pdns-2.9.21-2.x86_64.src.rpm

pdns-2.9.21-2.i386.src.rpm

pdns-2.9.21-2.x86_64.rpm

pdns-2.9.21-2.i386.rpm

 

Or you can download the GPL source tarball which includes the spec files for both x86_64 and i386

 

pdns-2.9.21-2.tar.gz



PTY allocation request failed on channel 0

January 16th, 2009 | Posted in Debian, Linux, Xen | No Comments

After creating a new VM on Debian Lenny, I got the following when trying to ssh into the DomU;

PTY allocation request failed on channel 0
stdin: is not a tty

Run the following to fix the issue;

apt-get install udev



Policyd Build Error

December 21st, 2008 | Posted in Debian, Linux | No Comments

policyd error Your OS doesnt support MSG_NOSIGNAL or SO_NOSIGPIPE

apt-get install g++ gcc

policyd.h:52:19: error: mysql.h: No such file or directory

apt-get install libmysqlclient15-dev


repair corrupted journal

December 21st, 2008 | Posted in Linux | No Comments

boot from cd – linux rescue

sh-3.1# umount /mnt/sysimage/data
sh-3.1# tune2fs -O ^has_journal /dev/sda6
sh-3.1# e2fsck -y /dev/sda6
sh-3.1# mount -t ext3 /dev/sda6 /mnt/sysimage/data
sh-3.1# rm -f /mnt/sysimage/data/.journal
sh-3.1# umount /mnt/sysimage/var
sh-3.1# tune2fs -j /dev/sda6
sh-3.1# exit



Categories