It is sometimes necessary to run two instances of mysql, like in my case. I need a mysql database in addition to the one Zimbra uses. One solution to this problem is to run the mysql database on a non default socket. This can be done by changing the following line in my.cnf
my.cnf
[client] ... socket = /var/run/mysqld/mysqld2.sock
Restart the mysql daemon afterwards to activate the change.
In PHP it’s possible to avoid programming the nondefault socket info whenever we use mysql
php.ini
[MySQL] ... mysql.default_socket = /var/run/mysqld/mysqld2.sock
If you don’t have access to php.ini you have to program this in your PHP code
$dbcnx = @mysql_connect('localhost:/var/run/mysqld/mysqld2.sock',$username, $password);
Posted by Hans-Henry Jakobsen
man -t passwd | ps2pdf -> passwd.pdf
Tags: ps2pdf
Posted by Hans-Henry Jakobsen
Vlogger is a program that handles large amounts of virtualhost logs and splits it to separate files.
This is a short HOWTO to configure it using Apache.
# aptitude install vlogger
Make sure you have working Apache server
Change the LogFormat line (there are multiple LogFormat lines – in this example we will change the one that is named combined) in /etc/apache2/apache2.conf. We must add the string %v at the beginning of it
vi /etc/apache2/apache2.conf
#LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
LogFormat “%v %h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
Add the following CustomLog line to the same file (you can put it directly after the LogFormat line)
vi /etc/apache2/apache2.conf CustomLog “| /usr/sbin/vlogger -s access.log /var/log/apache2″ combined
NOTE
We only need one CustomLog directive in our whole Apache configuration. Please disable all other CustomLog directives, especially in your virtual host configurations.
Restart apache
# /etc/init.d/apache2 restart
Vlogger will now create subdirectories in the /var/log/apache2 directory, one per virtual host, and create access logs that contain the current date in the file name. It will also create a symlink called access.log that points to the current log file.
Let’s assume we have two virtual hosts, www.example1.com and www.example2.com. Then this is how the /var/log/apache2 directory will look like:
# ls /var/log/apache2/ www.example1.com/ 09022008-access.log 09012008-access.log access.log -> 09022008-access.log www.example2.com/ 09022008-access.log 09012008-access.log access.log -> 09022008-access.log
Posted by Hans-Henry Jakobsen
This is a little script I’ve written to correct all my image files since the EXIF timestamp information is one hour out of sync. The filenames have been renamed to comply to the EXIF information and has to be renamed again because of the one hour scew. The filename can look something like this 20080102-1201_DSC_0910.JPG where the name is built up like YYYYMMDD-HHMM_Original_Filename.JPG
Remember to backup your imagefiles before you continue. You have been warned!
This is the files we are going to rename
20080102-1201_DSC_0910.JPG 20080105-1923_DSC_1006.JPG 20080111-1220_DSC00189.JPG 20080122-0929_DSC00190.JPG
The mmv command is a command that lets you move/copy/append/link multiple files by wildcard patterns. It can be installed in Debian (or Debian based distributions like Ubuntu) by issuing the command
# aptitude install mmv
Now rename the files back to their original name
# mmv "*_DSC*" "DSC#2"
The result after this operation looks like this
DSC_0910.JPG DSC_1006.JPG DSC_1179.JPG DSC_1302.JPG DSC_1587.JPG
Next adjust the EXIF information stored in the image files to fix the one hour difference. This can be done using different EXIF tools like exiftool, but I will show you how it can be done using jhead and exiv2. The advantage with exiv2 is that it can also handle Nikon NEF files while jhead only can prosess JPG.
The current timestamp can be determined as follows
# exiftool DSC_0910.JPG | grep "File Mo"
The result in this case is
File Modification Date/Time : 2008:01:02 08:34:09
# exiftool -AllDates+=1 DSC_0910.JPG
# jhead -ta +1 DSC_0910.JPG
Install the jhead package using aptitude as mentioned earlier for the mmv package
# exiv2 ad -a 1 DSC_0910.JPG
It is now time to rename the files back to the YYYYMMDD-HHMM_Original_Filename.JPG format I used before this operation. This operation has been describe in a previous post named Rename image files according to EXIF date
exiv2 -r'%Y%m%d-%H%M_:basename:' rename $(ls D*)
#!/bin/bash -x # Needed software: # exiftool # exiv2 # mmv # Script tested on Nikon D80 and Sony Cybershot DSC-W12 files # Make a printout of how the files look like now ls -l > repair_name_and_exif_before.txt # Rename files to remove date formatting back to original name mmv "*_DSC*" "DSC#2" # Change EXIF info on JPG files (order is important) exiftool -overwrite_original -AllDates+=1 D*.JPG # Preserve date/time of original file when writing exiftool -overwrite_original '-DateTimeOriginal>FileModifyDate' D*.JPG # Change EXIF info on NEF files (order is important) exiftool -overwrite_original -AllDates+=1 '-DateTimeOriginal>FileModifyDate' D*.NEF # Preserve date/time of original file when writing exiftool -overwrite_original '-DateTimeOriginal>FileModifyDate' D*.NEF # Rename files back to date formatting (YYYYMMDD-HHMM_Filename) based on the new EXIF info exiv2 -r'%Y%m%d-%H%M_:basename:' rename $(ls D*) # Make a printout of how the files look like after conversion ls -l > repair_name_and_exif_after.txt
Tags: Debian, EXIF, exiv2, jhead, JPG, mmv, NEF, Nikon, rename, Sony
Posted by Hans-Henry Jakobsen
This is just a test post to test pagination in WordPress. Pagination is unfortunately a function that not all theme creators implement. You can paginate by using the <!–nextpage–> Quicktag.
More information about wordpress pagination can be found in WordPress documentation http://codex.wordpress.org/Template_Tags/wp_link_pages.
Tags: Wordpress
Posted by Hans-Henry Jakobsen