Archive for the ‘Uncategorized’ Category.

OpenX permission issue

Everytime when I login to my openx installation, I had this error message

Error: File permission errors detected.
These may impact the accurate delivery of your ads,
See the debug.log file for the list of unwritable files

This has to do with some of the file permission error. For my case, I just need to execute this two command to fix my problem

chmod -R a+w /home/openx/var/cache/
chmod -R a+w /home/openx/www/images/


The terminal server has exceeded the maximum number of allowed connections

Encountered this problem with one of my customer’s server. A quick fix will be logging in remotely using console session to clear up the connections

mstsc /v: /admin

Replace ‘’ with your server IP.

After which, you can launch the Terminal Server Manager (Start -> Run -> tsadmin.exe) and clear up the sessions.

Hope this helps…

Remove string from file

As I have been trying to figure out how to remove a specific string and not leave a blank line in a file, perl has really saved my day.

perl -ni -e 'print unless/' virtualdomains

Back to developing scripts now 🙂

Hope this helps someone too.

Mass Delete Kayako 3 Comments

If you have more than 100 spam comments to delete, you might need to spend quite a fair bit of time to delete. Time is precious. Here is a quick way to mass delete all the comments.

DELETE swcomments, swcommentdata FROM swcomments, swcommentdata WHERE swcomments.commentid = swcommentdata.commentdataid AND swcomments.isapproved = '0';

I am not responsible for any damage caused in your system, please DO backup before you execute any SQL query.

Hope this helps!

MySQL Driver in Perl

This is a quick command to get it installed.

/usr/bin/perl -MCPAN -e 'install "DBD::mysql"'

Hope this helps!

WARNING: mismatch_cnt is not 0 on /dev/md0

I was about to head to bed when I receive a disturbing email from my BlackBerry phone.

A email from weekly cron.d send me this:

WARNING: mismatch_cnt is not 0 on /dev/md0

A quick command shows that the RAID array (md0) is the number of
unsynchronized blocks in the raid.

As you can see below, md0 is having 128 count of unsynchronized blocks.

[svr4:/root]# cat /sys/block/md0/md/mismatch_cnt
[svr4:/root]# cat /sys/block/md1/md/mismatch_cnt

Let’s attempt to fix it.
Continue reading ‘WARNING: mismatch_cnt is not 0 on /dev/md0’ »

fsck on reboot

In order to do a fsck on your disk on the next reboot, I prefer the following command:

shutdown -Fr now

-F: Force fsck on reboot.
-r: reboot after shutdown.

The next option that you can choose to use is as following:

touch /forcefsck
shutdown -r now


Perform smartctl on disk behind 3ware controller

As I notice that one of my box is having slight issues with the 3ware controller, it has been doing soft reset of the controller for the past week. One of the test I am running is smartctl, as the disk is behind a hardware raid controller, I need to invoke differently.

smartctl -d 3ware,0 -a /dev/twa0

3ware,0 means disk 0
twa0 is the controller number

Looks like both my disk is fine, moving on to do other tests.

Hope this helps.

Acronis SnapDeploy with Microsoft DHCP

In order to configure Acronis SnapDeploy with Microsoft DHCP, you need to modify two options so that when DHCP issue the IP address, the client know who to contact for the PXE Boot Images.

options 66 (hostname startserver = 192.168.X.X)
options 67 (name of startfile = bootwiz.sys)

Make sure that you restart the Acronis File Server and PXE Server after you modify the options.

This has being tested with Acronis 9 and Windows 2003 Edition.

Hope this helps 😉

Online backup using Linux Logical Volume Manager (LVM)

Performing backup of your logical volume is pretty easy and fast. It is the safest way to backup any “open” files/databases.

1) Creating a snapshot of your current LVM

[root@svr2 ~]# lvcreate -L1000M -s -n volbackup /dev/VolGroup00/datavol
  Rounding up size to full physical extent 1.00 GB
  Logical volume "volbackup" created

2) You should see lvdisplay stating the snapshot LVM.

[root@svr2 ~]# lvdisplay /dev/VolGroup00/volbackup
  --- Logical volume ---
  LV Name                /dev/VolGroup00/volbackup
  VG Name                VolGroup00
  LV UUID                H1s7bn-TKCu-sdfE-Xi0M-oZNA-ixvq-xsWvZj
  LV Write Access        read/write
  LV snapshot status     active destination for /dev/VolGroup00/datavol
  LV Status              available
  # open                 0
  LV Size                100.00 GB
  Current LE             3200
  COW-table size         1.00 GB
  COW-table LE           32
  Allocated to snapshot  0.00%
  Snapshot chunk size    4.00 KB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

3) Create a folder for it to do a proper mount.

[root@svr2 ~]# mkdir /backupvol
[root@svr2 ~]# mount /dev/VolGroup00/volbackup /backupvol

4) Do the backup now.

[root@svr2 ~]# tar -cf /root/datavol.tar.gz /backupvol

5) Umount, remove folder and delete the snapshot LVM

umount /backupvol
rm -rfv /backupvol
lvremove /dev/VolGroup00/volbackup

Hope this helps someone out there…