Tar based incremental backups

Posted by Michael Hendrickx on July 01, 2009
misc / No Comments

A small bash script I wrote to have incremental backups done on a unix server, and then pushed to a Windows File system. On the fileserver, we add this directory to the normal backup.

This is on a mail server, where emails are stored in MailDir format. We create weekly full backups on sunday, and daily incremental. This script is called daily at night from a cron job. Gotta love the scripting abilities of bash.

It might help you out, so here goes:

#!/bin/bash
# backup script is doing following items
# dump all incremental email into a backup file, gzip the backup file and
# move the file to an external file server

START_TIME=`/bin/date`
echo "backup started at: ${START_TIME}"

DOW_N=`/bin/date +"%w"` # number, 0 (sun), 1 (mon)
DOW_T=`/bin/date +"%F"`

TO_BACKUP="/opt/maildata/"
TEMP_FILE="/tmp/${DOW_T}_mail_backup.tar"
BACKUP_LOG="/tmp/mail.backup"
FILE_SERVER="/mnt/fileserver/" # mounted over SMB

# if it's a sunday, delete the incremental file and take a full backup
if [ ${DOW_N} -eq "0" ]; then
  /bin/rm ${BACKUP_LOG}
fi

/bin/tar -c -f ${TEMP_FILE} --listed-incremental=${BACKUP_LOG} ${TO_BACKUP}
/bin/gzip -f ${TEMP_FILE}
FILE_SIZE=`/bin/ls -lah ${TEMP_FILE}.gz | awk '{ print $5 }'`
/bin/mv ${TEMP_FILE}.gz ${FILE_SERVER}

## report, this goes in an email through cron
END_TIME=`/bin/date`; export END_TIME
echo "backup ended at: ${END_TIME}"
echo "data moved: ${FILE_SIZE}"

Archiving outlook emails, gmail style

Posted by Michael Hendrickx on June 16, 2009
fun, misc / No Comments

archive
In Nakheel we have a maximum email quota which gets filled up pretty quickly if you receive large attachements, such as presentations, manuals and silly movies. I wanted to build a macro that imitates Gmail awesome archiving method.

Based on the lifehackers’s article, my version had to move the my selected mails to a PST file on my disk, freeing up space on my “online mailbox”.

I won’t repeat how to make the macro and all, the lifehacker’s article does a very good job in that. I just made a few changes to the code, and that is below:

Sub Archive()
  pst_file = "C:\Backup\archived.pst"
  Set ns = Application.GetNamespace("MAPI")
  ns.AddStore (pst_file)
  Set ArchiveFolder = ns.Folders("archived")

  For Each Msg In ActiveExplorer.Selection
    Msg.Move ArchiveFolder
  Next Msg
End Sub

Tags: , , , , ,

When health warnings and math don’t go together

Posted by Michael Hendrickx on June 14, 2009
misc, uae / 1 Comment

Health Warning - Gasoline

Health Warning - Gasoline


I got an email today from a colleague, warning about a poisonous gas called gasoline. Odd in a oil-rich country though.

If you read it, you’ll notice that 15 degrees Fahrenheit is 6 degrees Celcius or 60 degrees Celcius. In reality, 15 degrees Fahrenheit is -9 degrees Celcius. I guess this memo wasn’t really talking about Abu Dhabi’s sunshine.

Let’s assume that you don’t want to open the windows for a while when driving in -9 degrees. And that the gasoline fumes you get while filling up at a petrol station are bit more dangerous (or more fun?) then your average plastic seat covers.

Tags: ,

Offline, sorry

Posted by Michael Hendrickx on May 22, 2009
Uncategorized / No Comments

I’m very sorry I haven’t updated my blog for a while. I went on a holiday, and fell sick when I got back in Dubai. Give me a few days, and I will update this again!

Thanks,
Michael

Yahoo overhauls its image search

Posted by Michael Hendrickx on April 05, 2009
Uncategorized / No Comments

Yahoo overhauled it’s image search, and some say it’s a better search than Google now. I wouldn’t hurt for Yahoo, as they have to re-gain some market share in the world of search engines.

For the UAE, the bad part though, is that most of the images are feeded from Flickr, which is blocked here.

Logging into SSH with a different username

Posted by Michael Hendrickx on March 26, 2009
misc, security, sysadmin, web / 3 Comments

I love SSH. SSH is the de-facto service for remote server management, especially in a CLI environment.

Being a avid Linux user, and spending quite a bit of time on OSX lately, I often SSH into several servers remotely. Being subject to “username conventions”, you don’t always share the same username across machines. And I always wondered how one could just type ssh hostname instead of providing the username.

Seems that, by creating a .ssh/config file with following contents:


Host server.example.com server
  User username

WIll make life easier, as you can in the future only do a “ssh hostname”. I didn’t know this.

Happy Birthday Linux

Posted by Michael Hendrickx on March 13, 2009
Uncategorized / 1 Comment

Yay, Linux exists 15 years. The little rebel OS was put to public 15 years ago. It’s architecture and philosophy lead to the popularity of other operating systems (BSD, and thus also Mac OS).

Even though I work quite a significant amount of time on Mac now, i still use Linux every single day. Best OS, evar.

Keeping windows services’ running, ghetto style

Posted by Michael Hendrickx on February 24, 2009
sysadmin / No Comments

A small post, but so I can have it as a reference if I ever encouter it again. We’ve setup a Windows 2003 Domain, and run DNS on both the Domain Controllers. We have terrible issues with DNS always shutting down, and disabling itself, so it won’t boot up again.

While we are breaking our heads on how this happens, we made a small two-liner script to enable a Windows service over the command line. We’ve put this in the recovery tab, and scheduled it as a task to run every hour.

The code to enable the DNS service, and to restart the service is below:


sc config DNS start= auto
net start dns

I know it’s very ghetto way of keeping DNS running, but we’re figuring out why DNS always shuts down. Until then, this provides us necesarry DNS uptime ;)

Thanks,
Michael

Tags: , , , , , ,

Dubai Twestival 2009

Posted by Michael Hendrickx on February 13, 2009
fun, uae / No Comments

Yesterday evening, it was the Dubai Chapter of the Twestival. Twestival is a festival, organized by the Twitter community worldwide. Over 165 cities worldwide participated on this event to support the Charity Water foundation.

The Dubai chapter was held yesterday in Barasti, Mina Seyahi.

It was an amazing event, and had a great turnout. It’s very handy to put a person behind a “twitter username”, and met many new twitterers.

Thanks for the awesome team who organized it,
m1ke

Tags: , ,

.tel TLD open for public tomorow

Posted by Michael Hendrickx on February 02, 2009
Uncategorized / No Comments

The new .TEL TLD willbe open for public tomorrow. It starts at a premium of close to 300 USD, and is destined for telecom operators.

Though, i’d say the more expensive would be http://ho.tel and http://mo.tel, corporates are more interested in the .com TLD anyways.

Thanks, and .tel your friends,
m1ke

Tags: ,