You’ll want to archive your joomla site using .tar.gz

I was building a script to archive my joomla folders on a linux server. I noticed it takes a lot of time to complete so I’ve run  a few tests on one website. Here are the results:
[root@host]# time tar cjf /backup/2010-11-30/test.tar.bz2 -C /var/www/site .
real    0m55.299s
user    0m53.929s
sys     0m1.314s

[root@host]# time tar czf /backup/2010-11-30/test.tar.gz -C /var/www/site .
real    0m15.545s
user    0m12.311s
sys     0m0.947s

[root@host]# time tar cf /backup/2010-11-30/test.tar -C /var/www/site .
real    0m1.609s
user    0m0.081s
sys     0m0.915s

[root@host]# ls -l /backup/2010-11-30/
total 672980
-rw-r–r– 1 root root 287815680 Nov 30 05:17 test.tar
-rw-r–r– 1 root root 197970835 Nov 30 05:17 test.tar.bz2
-rw-r–r– 1 root root 202647314 Nov 30 05:17 test.tar.gz
You can see that if we use tar we finish very fast but since there’s no compression we loose a lot of space. Gzip on the other hand looses only 4 Mb to Bzip2 but gains us 40 seconds. So gzip is what I will use from now on.

Update: I forgot to mention in the original article that the site was already archived a few times before this test so the files were probably already cached. Running the same script on my webserver (for all the sites installed) with bzip2 was way slower in total than being run with gzip compression a few days later (so under similar conditions) – and the space lost was not worth mentioning.

Also this is probably not limited to joomla – anything would archive slower with bzip2 but with better compresion.

After importing products from CSV in Virtuemart a discount is showed

After importing products into Virtuemart using CSV Import a discount is shown being available – although offering the same price as the list price. This happens because no discount id is set in the table. Running the following on the mysql table fixes that:

UPDATE `jos_vm_product` SET `product_discount_id`=0 WHERE 1

Mount a FTP site from fstab

I still have clients or websites where the most convenient (middle ages based) method of exchanging files is FTP.

Since I’m lazy by nature I don’t like firing up a FTP client, I’d prefer to just have it available on request. For a while the KDE Network Places did the trick. But I decided I want it even easier. Behold curlftpfs.

sbopkg -ki curlftpfs
(replace that with apt-get, yum or compile from source depending on your distro)

later and I could do this in fstab:

[ccNe_bash] /mnt/clientusingftp fuse rw,allow_other,noauto,user 0 0
I left noauto because access to this folder is slow on slower remotes hosts. Of course you can also do this at the command line:

curlftpfs sunet/

FreePBX fails uploading mp3’s for music on hold

FreePBX logoThis is caused by a couple of problems:

1. the /var/lib/asterisk/moh is missing (or has the wrong permissions). Be sure it’s there and has the right owner (asterix:asterix) and permissions

2. Sox has to be installed. What the error logs miss to inform at the first glance is that you also need mpg123 otherwise you’ll get this:

Error Processing: “sox failed to convert file and original could not be copied as a fall back” for Johnny Cash – Solitary Man.mp3!

This is not a fatal error, your Music on Hold may still work.

Have fun.