James Emmrich

As mentioned before somewhere in my blog, here is the script I have written to back up my databases. This is actually my local backup script, I have a much different one on the server which uses a passwordless ssh connection to backup the databases offsite.

#!/bin/sh
# Database backup 2008 <jemmrich@gmail.com>
# Nightly Usage:
# 0 0 * * * /home/james/Dropbox/Home/mobilewolf/scripts/backup.sh &> /dev/null

LOGFILE="/home/james/Dropbox/Home/mobilewolf/databases/databases.log"
BACKUPDIR="/home/james/Dropbox/Home/mobilewolf/databases"
STARTTIME="$(date +%Y-%m-%d-%r)"

# MySQL Login
SQLUSER="sqluser"
SQLPASS="sqlpass"

# Dump databases
echo "*** Database Backup Started: $STARTTIME" >> $LOGFILE

# Keep yesterdays databases
rm -f $BACKUPDIR/yesterday/*
mv $BACKUPDIR/*.gz $BACKUPDIR/yesterday/

for i in `echo "show databases" | mysql -u $SQLUSER -p$SQLPASS | grep -v Database`;
do
 mysqldump -u $SQLUSER -p$SQLPASS $i > /tmp/$i.sql
 echo $i >> $LOGFILE
 gzip /tmp/$i.sql

 # Send Databases
 cp /tmp/*.sql.gz $BACKUPDIR/

 # Remove our dumps to keep us clean
 rm -f /tmp/*.sql.gz
done

echo "*** Database Backup Ended: $(date +%Y-%m-%d-%r)" >> $LOGFILE
echo "\n" >> $LOGFILE

Setup

  1. Change the user and password to a user that has ability to access all databases for dump
  2. Download and set executable permissions chmod +x backup_databases.sh
  3. edit cron to execute every night: crontab -e
  4. add: 0 0 * * * /home/james/Dropbox/Home/mobilewolf/scripts/backup_databases.sh &> /dev/null

Ideas for your setup

  • The line following “Send databases” replace cp, with scp to send the databases to remote server. You will need to have passwordless ssh connections setup.
  • Have the log file emailed to you once completed

My Future Improvements

  • Enable backup archiving for the past week rotated daily so I can go back to a database from 2 or 3 days or even a week ago


Tweet This

21 Feb, 2010

How I use Dropbox on Ubuntu

Posted by: James In: Linux| ProTip

Dropbox.com has become a huge time saver for me, and most likely a life saver as well.

I have a folder in my Dropbox called Home. Here I have sub folders for each machine that I have. My two laptops, a desktop which hold computer specific files that are different for each computer I have.

Files such as:

  • /etc/hosts
  • /etc/fstab
  • /databases/

Rather than copying these manually, I have simply moved the files to the dropbox and then symbolically linked them. That way when the system updates these files, Dropbox does it’s sync.

The databases folder is a folder which contains database dumps. My crontab is setup to nightly dump databases in tar form and place them here, for Dropbox to store.

I also have a folder called Resources. This contains files that are shared between computers. I have symbolically linked my .fonts folder here. Now whenever I install a new font for a design project, all my other computers are updated too.

For chat software like Pidgin and XChat, I have symbolically linked their folders .purple and xchat2 respectively, to my Dropbox home folder. Because these will be shared between computers I don’t have them in their respect computer sub folder. Now no matter what computer I chat on, my chat logs and software settings are up to date.

Projects that I work on are placed in my Dropbox under a folder called Projects, with each project as its own sub folder.

During my work, or daily routine I tend to shuffle, download, delete, and create new files. While I don’t always place these files to my Dropbox, I am very careful to not hold them on my laptops for long periods of time.

For files that I want to hold, I either move them to my Dropbox or to my NAS server depending solely on their importance and need of accessibility.

The results

I can now format my hard drive at any time, provided that Dropbox has had time to sync any changes. I also have the feeling of security knowing that my hard drive crashes will not take me out of commission.



Tweet This

James Emmrich is one of those people that works behind the scene of events and goes unnoticed. The web guru of the
Walton Trans Can, James is fan of the sport, a rider, and now has launched Motopicks. Motopicks started last
weekend with the first round of the AMA Monster Energy Supercross. We caught up to James to talk about his new
project.

James Emmrich is the man behind the new www.motopicks.com fantasy league.

MXP: Hey James, how is it going?
James: Things are going great.
MXP: So who are you for those that don’t know!
James: Well, I grew up in Walton and have been around Motocross for as long as I can remember. I managed to talk
my parents into getting me a Yamaha YZ 80 and started racing a week after that. I am not going to lie, I was quite
nervous, but after my first moto I was hooked. For the longest while all I did was race, but the geek in me had me
lugging around a 500 page programming book each weekend to read between motos. These days I still race, but now I
am involved with entrant management for the Walton TransCan handling entries, their websites and answering
questions. If you have raced the TransCan, you have probably talked to me in some form or another.
MXP: We see you out there rocking the old two-stroke KTM250? You are one of the two-stroke hold outs!
James: Yeah, I don’t know how long I will hold out, but that has been a great bike! It is a 1999 and I race it almost
every weekend with no issues!
MXP: Most don’t know, the whole entry and gate selection thing is maybe the most stressful part of the Walton event.
Lots of emotions, huh?
James: Yeah, it’s quite the process, and there have been far too many stressful moments to count. However, each
year things are becoming easier and easier. The first two years were pretty rough. TransCan greenhorns always have it
rough the first 2 years; if you make it that long. I think the system [MotoRegistry.ca] that I have developed has not only
made the process easier for everyone, but less stressful for the event staff allowing us to focus on other areas.
MXP: Tell us about Motopicks?
James: MotoPicks is a Fantasy Motocross League that Mark Perrin and I are running. Since Brett Daily’s Motoleague
shut down, I had a few people approach me and convince me to give it a shot. I guess the withdrawl got to them. This
is MotoPicks’ inaugural year.
MXP: Last weekend, you guys kicked off with the AMA Monster Energy Supercross Series. How did it go?
James: It went very well. I was a little nervous being our first major event, and kept by the computer and phone to
answer any questions as they arrived. Besides a few delays on our part getting the word out, I learned a lot and will be
putting it to good use come outdoor national time. Every day there are people signing up and a few thank yous along the
way, which is always nice!
MXP: Are there plans to do the US Nationals, and the CMRC Monster Energy MX Nationals?
James: Oh yes, for sure. The MotoPicks idea originated from the need for filling the CMRC Monster Energy National
Fantasy League void. It’s going to be a big year for us taking on both US Nationals and the CMRC Nationals. There are
big plans to come. We may even do a couple other events on top of those two.
MXP: Okay, so how can readers find you and Motopicks?
James: You can find me at any CMRC race in Southwestern Ontario, and maybe some out of province Nationals in
2010. For Fantasy League fans, visit http://www.MotoPicks.com/ to register and sign up. We also have Twitter and
Facebook, which can also be found linked on our website so feel free to participate in discussions and spread the word.
MXP: Thanks for taking the time to do this!
James: Thanks, and before we go, I would like to thank everyone for their feedback on MotoPicks.

Sign up for motopicks. Its the place to go.!!!



Tweet This

Upcoming Events

  • Sat, Mar 13:AMA Supercross - Toronto
  • Sat, Mar 20:AMA Supercross - Dallas
  • Sat, Mar 27:AMA Supercross - Jacksonville
  • Sun, Apr 4:CMRC South Western Ontario - Gopher Dunes Practice
  • Sat, Apr 10:AMA Supercross - Houston
  • Sun, Apr 11:CMRC South Western Ontario - Gopher Dunes Spring Classic
  • Sat, Apr 17:AMA Supercross - St. Louis
  • Sun, Apr 18:CMRC South Western Ontario - RJ Motosport Spring Classic
  • Sat, Apr 24:AMA Supercross - Seattle
  • Sun, Apr 25:CMRC South Western Ontario - Auburn Hills Spring Classic

Flickr PhotoStream

    Montreal SupercrossAuburn Hills Aug 31 2008Auburn Hills Aug 31 2008Auburn Hills Aug 31 2008Auburn Hills Aug 31 200827000km milestonePissing at Transcan 2008x7-29-7-1360x7-29-7-1019x7-29-7-1002x7-29-7-972x7-29-7-941

Twitter Me

I'm a totally rad web application developer, linux affectionado, and a super hardcore motorcycle enthusiast. I'm self employed and have big ideas and big dreams.


Twitter Updates