WL-HDD Wiki Downtime
December 17th, 2007
I recently became aware of some MySQL issues with my WL-HDD wiki which have made the site inaccessible recently. I am currently working on the problem and hope to have it fixed as soon as possible. Please bear with me as this is quite difficult to do on an incredibly temporamental internet connection on the other side of the world (China) and without my own PC and tools.
Hope this has not caused too much inconvenience. If you are desperate to use a particular tutorial you can always use the cached version via a google search.
Will keep you updated on this.
Google Sitemap Index Generator
March 20th, 2007
I decided to write a shell BASH script which can be run as a CRON job to generate a sitemap index file for Google Sitemaps. A sitemap index file points to all of your sitemaps for a particular domain (eg. http://www.sprayfly.com/)and Google will crawl each one of these indexed sitemaps individually. I want to regenerate the sitemap index file every day so that the <lastmod> date changes every day. This ensures that Google keeps checking your sitemaps.
The script is set up to index three different sitemaps but contains instructions on how to modify it to add more. Just download it, upload it to your server (behind the public_html directory), give it execute permissions and run it (as a CRON job if you want):
mv sitemapgen.txt sitemapgen.sh
chmod +x sitemapgen.sh
./sitemapgen.sh
Free Mountain Bike Wallpaper
March 20th, 2007
If you are looking to spice up your desktop and are a bit of a mountain bike fanatic then read on…
Mountain Bike Cumbria is giving away some top quality Mountain Bike wallpaper for your desktop… for free!
As well as some MBC themed wallpaper (that juicy green colour), there are also some great high resolution action shots taken by James himself.
The wallpaper is available for download in several sizes: 800×600, 1024×768 and 1280×1024
jonosql2email, my MySQL email backup solution
March 19th, 2007
With very few of the BASH scripts out on the internet fitting my specific requirements, I decided to write my own shell BASH script to make email backups of MySQL databases.
Here is what I wanted the script to do:
- First check whether or not the day is Sunday (or another day of the week)
- If the day is not Sunday, end the script
- If the day is Sunday, export and compress all tables and contents of a specified MySQL database to a temporary file.
- Email this file as an attachment along with an automatically generated subject and message body to a chosen email address. Provide the ability to use two different UNIX mailing tools - to provide for different server setups.
- Delete all the temporary files generated
Instead of backing up the entire database (name, etc.) I prefer instead to backup all the database’s tables and contents. This means that when you want to restore data, you can simply create a new database in PHPMyAdmin and then import the dump file into this. The new database can even have a different name to the old one. Essentially, its just the same as backing up the database but this solution is more flexible.
Configuration
You will need SSH access to your server to be able to do the following.
I schedule the script as a CRON job on my host’s webserver. This runs multiple times every day. However, a backup is only made on Sundays although this day of the week can easily be changed. You need to upload the script to a directory below public_html, rename it and give it execute permissions:
move jonosql2email.txt jonosql2email.sh
chmod +x jonosql2email.sh
You need to edit the script with your preferred text editor. The only values that need changing are:
fullbackup="Sun" # The day of the backup (Mon Tue Wed etc)
email="email@address.com" # The Email Address you want to send the backup to
dbhost="localhost" # the database server (normally localhost)
dbuser="db-username" # the database user name
dbpass="password" # the database password
dbname="db-name" # the name of the database
All you need to do now is run the script (either manually or via CRON) and you should get an email to the specified address with the backup file attached:
In an SSH Shell enter the following:
If you are in the directory within which lies the script-
./jonosql2email.sh
If you want to give an absolute path (this depends on your server setup!)-
/home/sites/example.com/jonosql2email.sh
Download the Script
Hope this is useful info! Please give me some feedback on the script if you use it.