Category: Code

February 20th, 2008

Simple MySQL Backup Using Perl

I present to you a short script to automate backup and compression of a MySQL database using perl on a Linux system. I had to solve this problem today and figured there might be others out there in need of the same solution. Store the script in a safe location, hidden from the Internets, and chmod it to 700 to prevent other users from viewing the source (because it contains db login information). Customize the variables at the top of the script and test it out (perl sqlBackup.pl). If it runs without outputting any errors, add a line to your crontab file to run the backup at the desired interval.

There are of course better ways of doing this, namely this one. I am doing it my way because I’m more comfortable with perl and this script gives me more flexibility and a bit of debugging in case something goes wrong. This script assumes you’ve got cron setup to email you any output, so you should receive notification if something goes wrong.

read more …

  • Digg
  • del.icio.us
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Technorati
  • Facebook
  • LinkedIn
  • Twitter
Posted in Code  |  No Comments

December 30th, 2007

Code of the Samurize

I wrote a VB script for Samurize, an easy-to-use, free Windows desktop playground for creating MacOS-like widgets and powerful system monitoring tools. Building my own desktop widget, I discovered that there wasn’t a built-in tool or any plugins available for identifying the current WiFi security mode in use. That is, I want my widget to tell me if I’m connected via WEP, WPA, etc. On my Linux systems, I can see at a glance what network I’m connected to and what security is in use. In Windows, this is slightly more challenging.

It wasn’t terribly difficult to create my own once I learned a bit about navigating the Windows Management Instrumentation, and I also learned that Samurize doubles as a handy testing ground for all kinds of VB scripts. Here is the result (click on the image to see my desktop widget that I’ve integrated this into):

Wireless Mode Indicator

You can download my Samurize config file, which contains the script and indicator icons, from the Samurize website. I have also included the VB code below.

read more …

  • Digg
  • del.icio.us
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Technorati
  • Facebook
  • LinkedIn
  • Twitter
Posted in Code  |  No Comments