Rsync (Backup Files)

Posted by Dave Eddy on Sep 20 2010

What is rsync?

Rsync is a program that can be used to backup your files. Much like Apple’s Time Machine, or syncing an iPod, it can be used to sync your data with a remote server, creating redundancy in your data to help keep it safe. By default rsync comes with Mac’s and most Linux distributions; I don’t know about Windows.

I set up a script to rsync all of my documents, pictures, music, etc to dataDyne (my raid). Rsync will check for differences in the local files (on my laptop) and the remote files (on dataDyne), and automatically sync the two computers. Rsync will transfer files over SSH so it is a secure connection; having SSH keys really helps here so it doesn’t keep asking for a password. Only changes I make on my laptop will affect rsync, so the files on dataDyne will match what files are on my laptop (one-way sync), much like the same way an iPod will match changes made to iTunes, not the other way around.

The music is sent to a Public directory on my raid, because it is [shared using daap][firefly].

Read More...


PBX - Private Branch Exchange

Posted by Dave Eddy on Sep 20 2010

Mike got a couple of “Digium Quad Tdm400P” PCI Phone Cards from a friend so we decided to use a spare computer that was in our apartment and turn it into a PBX.

Were running Trixobx to manage the PBX, and all of the configuration is done through a webGUI.

So far we have 3 phones up and running. Extension:

  • 111 Mike
  • 112 Dave
  • 115 Server Room

All of the phones can call each other. If a message is left on a persons voicemail it will be forwarded to their email. Each phone can also order a wake up call!

Picture of the desk in the server room where we configured the PBX. You can see the phone next to the keyboard.

Picture

Picture of the 2 cards in the back of the computer.

Picture


NES Modding

Posted by Dave Eddy on Sep 20 2010

NES - Nintendo Entertainment System

I modded my NES back in 2005, and I still use it today to play games.

I added 12 blue LED’s to the Nintendo, and added a plexi-glass window to the top of the Nintendo to make the lights more visible and to see the game cartridge that is in the Nintendo.

I used a dremel to cut out the top of the NES and then installed the plexi-window.

There is a switch on the back that can turn on and off the lights on the NES, and it operates independently of whether or not the NES is turned on or off.

1

2

3

4


iTunes Music Sharing on Ubuntu

Posted by Dave Eddy on Sep 20 2010

Firefly Media Server

I installed the Firefly Media Server on dataDyne a couple of weeks ago. Firefly is in the standard Ubuntu repositories under the name mt-daapd, because it literally is a daap daemon. It allows you to pick a directory on your computer and share the media over the standard iTunes port (3689).

Installation was pretty straight forward, because you can connect to your computer on port 3689 and you get presented with a web interface to configure the daap share. Now, when i rsync my music from my laptop to dataDyne, the music automatically gets shared to my local network and is visible to anybody using iTunes.

Read More...


Import / Source Files in Bash

Posted by Dave Eddy on Sep 20 2010

What is importing/Sourcing?

Importing files in Bash is a way to take a bash file, and implant (import) it in another script temporarily during runtime. This can be handy if you have a file that just has a couple functions in it, and you want to use those functions (sound a lot like programming?)

How To Source/Import Files

There are two ways to import files in bash, and both do the exact same thing, they just have different syntax. You can use the source command to import a file.

source functions.sh

…or you can also use a period.

. functions.sh

Sourcing is done when bash first starts when you open a terminal or ssh into a server using the bash shell. Bash first starts, and then it sources your .bashrc file or your .bash_profile file (depending on how you login), which reads in variables that pertain to that session of bash.

Read More...


How to Use SSH Keys

Posted by Dave Eddy on Sep 20 2010

What are ssh keys?

SSH keys are used for a user to authenticate over ssh without using the standard username/password combination. Because of the nature of the cryptography used, they allow a user to login without entering a password.

An ssh key is a type of public-key cryptography, with a public and private key-pair. The private key is, like its name says, meant to be kept private. When you make a private key, you should hold onto this private key and keep it secure; it is what is used for you to prove you are who you say you are. You can think of it like your password saved in a file. It is NOT actually your password stored in a file, but I compare the two because the file should be safeguarded with the same care as your passwords.

The public key can be published, it does not need to be kept secure. The public key allows people to encrypt data, but not decrypt it. In order to decrypt the data the private key is needed, that’s why it is important to keep it secure. The private key is kept on your client computer, and the public key is kept on your remote server, that will allow you to ssh from your client to your server using the ssh key.

Read More...


How to Use Cron

Posted by Dave Eddy on Sep 20 2010

What is Cron?

Cron is a task-scheduler for Unix. Cron is used to automate processes on a computer, such as backing up files, rotating logs, or anything else you can think of. I use cron on daveeddy.com to backup wordpress and mysql databases. The simplest way to access cron and add tasks is by editing the cron table, and this can be accessed by this command:

crontab -e

This will open up a text document that holds the cron table for the current user.

To simply view the current cron table without editing it you can run:

crontab -l

Cron Users

When a script executes from cron it is executed with the same privileges as the user who owns the cron table. For instance, if login to my server as dave, and then edit the cron table to run a script, that script would run as user dave (even if I’m not logged in when the script is scheduled to run.)

Read More...


Functions in Bash

Posted by Dave Eddy on Sep 20 2010

What is a function?

A function in Bash is like a function in any programming languages. A function is a subroutine in a program, and though I wont go into detail on that here you can learn more about it at wikipedia.

How to

In bash the syntax to create a function is really simple, here is an example.

function sayHello() { echo hello; }

This creates a function called sayHello that, when called, will echo “hello” to the screen. To call this function inside a script is also simple, you treat sayHello as though it is a command that you would call just like any other in the script. For example:

#!/bin/bash
function sayHello() { echo hello; }
echo "about to call the function."
sayHello
echo "done"

Read More...


File Server - dataDyne

Posted by Dave Eddy on Sep 20 2010

dataDyne - 9.5TB network storage tank

The 250gb hard drive in my MacBook just isn’t enough anymore, so I bought some equipment to set up a NAS (Network Attached Storage). The equipment I bought:

I also bought a 4gb CF card, and a CF to IDE adaptor, because i had originally planned on using freeNAS as the operating system, and free up space in the case (by not needing a hard drive to install the operating system on). But i decided to go with Ubuntu instead, and ditch the CF card route. I chose Ubuntu because of limitations in the software raid implementation in freeNAS. FreeNAS doesn’t have the ability to grow an existing RAID, so if down the line i wanted to add another hard drive, freeNAS wouldn’t allow it, but Ubuntu would.

Read More...