RSS feed

mount: could not find any device /dev/loop#

July 1st, 2009 | Posted in Blog, Linux | No Comments

If you get the above error while trying to mount an ISO image, try to the following;

Option 1

MAKEDEV loop (If it doesn’t exist already)

modprobe loop

mount -t iso9660 -o loop yourisofile.iso /mnt/iso

Option 2

cd /dev/;mkdir loop;cd loop;mknod 0 b 7 0

mount -t iso9660 -o loop yourisofile.iso /mnt/iso



Find files between two dates

June 23rd, 2009 | Posted in Blog, Linux | No Comments

# touch -amt 200906220000 /tmp/date1
# touch -amt 200906222359 /tmp/date2
# find / -type f -newer /tmp/date1 -a ! -newer /tmp/date2–



apt-get update GPG error

June 23rd, 2009 | Posted in Blog, Debian, Linux | No Comments

W: GPG error: http://ftp.uk.debian.org etch Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B
W: There is no public key available for the following key IDs:
9AA38DCD55BE302B
W: You may want to run apt-get update to correct these problems

 

Solution:

 

# gpg –recv-keys 9AA38DCD55BE302B
# gpg –export 9AA38DCD55BE302B | apt-key add —

 

OR

 

# apt-get install debian-keyring debian-archive-keyring
# apt-key update



allow_url_fopen per domain

March 12th, 2009 | Posted in Blog, Linux, Plesk | No Comments

On Plesk you can allow allow_url_fopen per domain by editting the vhost.conf file for that domain and set the php_admin_flag as bellow.


php_admin_flag allow_url_fopen on

Once you have done this, run the Plesk magicwand

/usr/local/psa/admin/sbin/websrvmng -v -a


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'



Categories