How to backup your iPhoto pictures and videos to a NAS w/ rsync

This is how I backup my iPhoto stuff. I know that Apple has tools to do this, but I don’t use TimeMachine and keep most of my backups on my NAS.

I also keep my iPhoto Library on an external drive (to save space on my local SSD drive).

This is the simple script that I run in the Terminal:

#!/bin/bash
    if [ -d /Volumes/Monster/Private/iphoto_pictures ]; then
    if [ -f lock ]; then
exit 1
    fi
      touch lock
rsync -av /Volumes/Fujin/iPhoto\ Library.photolibrary/ /Volumes/Monster/Private/iphoto_pictures/iPhoto\ Library
   rm -rf lock
     fi;

What I’m doing here is first off, checking to see if the NAS is mounted. In my case, my mount name is “Monster” and the directory were I put my pictures is /Private/iphoto_pictures, so I check to see if the directory exists. If it does, I proceed to check if a lock exists. The reason I create a lock is so that I don’t have more than 1 backup job running at once. I keep this script running in my crontab, so that if the NAS is mounted and there is no lock, it will call rsync to copy all of the files in my iPhoto library into the one on the NAS.

I’ve had no issues with restoring so far – to restore, just need to rsync the other way.

Hope this helps.

Wait … before you move to Tomato from DD-WRT!

If you’re reading this, it’s probably too late. You’re probably already running into this issue:

401

and it’s probably driving you nuts!

If you haven’t done the move yet, good. Telnet into the router and run:

nvram get http_username

and

nvram get http_passwd

The way that Tomato and DD-WRT store passwords usernames and passwords is different – DD-WRT stores them encrypted whereas Tomato doesn’t, so with this, you can use it to log into Tomato after you’ve done the move. I call it a move and would hate to call it an upgrade, because some hardcore DD-WRT users might be offended.

Now, if you haven’t done this already and are seeing the error, this will be interesting. With the ASUS router, I think I was able to just do a 30-30-30 reset and it took care of it. Unfortunately with Shibby’s implementation of Tomato, they don’t implement the reset button, so you can press the reset button until you’re blue in the face and it won’t do a thing. On other routers, you may need to press the SES/AOSS button. On the Netgear Nighthawk, it’s the WIFI on/off button. You can hold it down and it will start a password-less telnet daemon at port 233 if held for 20+ seconds. So, when you’re booted into Tomato (the web login will still say DD-WRT) and you can’t log in, hold the button down for 20+ seconds and then go to the command prompt and run:

telnet <router IP> 223

There, you should be able to run the 2 ‘nvram get’ commands and use that info to log into the router and do a reset from there.

Hope this helps!

Why I choose TomatoUSB over DD-WRT

I recently bought a Netgear Nighthawk R7000 for my home router. I figured it would be a good time to get a new router, so I was debating between this on and the ASUS (RT-AC68U). I chose the Nighthawk purely based on price. It was 10% off at Target. 🙂 When I shop for a router, I normally try to get open-source. The reason for this is so that I can hack it as I enjoy doing things like that and I like to use features that are not designed the original product. Why companies build routers and put their own firmware on it is beside me. I really wonder why they don’t just use the open-source stuff since it’s so good. If you look at my blog, you’ll see that I have run DD-WRT on my older routers as well.

The reason I decided to go with Tomato instead of DD-WRT is because of a couple of features that I like in Tomato. The first feature is the QOS transfer rates.

Screen Shot 2014-06-11 at 10.59.05 PM

I haven’t found where I can easily do this in DD-WRT. The reason I like this feature is because I can instantly know who is using up my bandwidth.

Another feature I like that unfortunately does not work on this router yet is A feature where I could see all of the URLs that I’ve visited and searches that I’ve done. I hope that Shibby fixes this in the 121 build.

Screen Shot 2014-06-11 at 11.01.41 PM

These are the two major reasons why I decided to use Tomato over DD-WRT. I’ve also run into issues with using the wireless bridge feature in DD-WRT where Tomato worked very easily.

I would love for some DD-WRT hardcore fans to debate with me. I’ve used DD-WRT firmware for a long time and just switched to Tomato very recently. The main reason I switched to Tomato was back in the days when I had the ASUS RT-N16 router. DD-WRT had Wi-Fi that kept dropping off almost daily and I had to find something better and Tomato was the answer at the time.

Please post your comments! Thanks!

P.S. Here‘s a good link on how to set up DD-WRT with a VPN.

 

 

NFS is better than CIFS (at least for streaming video) or How and why to use NFS instead of CIFS on Mac OS X

For the longest time, I thought that my wifi connection was just too slow. Trying to play a movie with VLC player was just painful! I was trying to play movies and it would buffer for a long time and while it was playing, would stop for a little while, pixelate, and play again. I just finished gave up on it for a long time. I bought a new router, a Netgear Nighthawk 802.11ac router that was supposed to be much faster. Unfortunately I didn’t look at my MacBook Pro specs and see that my wireless on the laptop didn’t support 802.11ac! No problem though – still keeping the router. The range on the router is much better than my old Belkin Play N600.

Just for the heck of it yesterday I decided that maybe NFS would be better than CIFS. I worked at Sun Microsystems for 4 1/2 years. I should’ve known this!

I think I tried using NFS on Mac a while back and it didn’t work and I just gave up. The error I got was this one:

Screen Shot 2014-06-09 at 12.35.19 PM

 

I’m glad I revisited this. Because of this error, I just figured that Finder didn’t mount NFS. Since Mac OS X does include showmount however, I thought maybe it does it via command line.

Doing a quick google search, I found that to mount NFS, because Linux wants the server to use ports <1024 and Mac OS X wants >1024, you need to use the ” -o resvport” option when doing the mount via command line.

sudo mount -t nfs -o resvport 192.168.0.11:/home/Monster /s

You don’t need to do it that way. Finder works just just fine. All you need to do is on the server side, add insecure as an option into /etc/exports like this:

/home/Monster *(rw,sync,no_subtree_check,insecure)

Then in Finder, you can use the familiar  ⌘K and give

nfs://192.168.0.11/home/Monster

Then, your network share should be mounted and you should have access to it. That said, you now are subject to POSIX file permissions.

Hope this helps!

Postfix queue management

Haven’t touched Postfix in a long time since I do very little administration work anymore, but recently found a server that had a ton of mail queued up.

The way I used to manage it was with qvmenu.pl. You could find it here – http://taz.net.au/postfix/scripts/qvmenu.pl – it shows a graphical (curses based) user interface that allows you to select messages, read them, delete them, etc.

What if I wanted to really delete a ton of messages though? I did a quick search and found http://www.howtoforge.com/delete-mails-to-or-from-a-specific-email-address-from-postfix-mail-queue and modified the command to work for me. I decided to run these commands:
mailq | tail +2 | awk ‘BEGIN { RS = “” } / MAILER-DAEMON*/ { print $1 }’ | tr -d ‘*!’ | postsuper -d –
mailq | tail +2 | awk ‘BEGIN { RS = “” } / root@wuhan\.shocknetwork\.com$/ { print $1 }’ | tr -d ‘*!’ | postsuper -d –

This way, I’m getting rid of all of the bounce and double bounce messages and also the ones from root that probably aren’t important.

Adventures in the quest to install Lion on my MacBook Pro …

This was pretty fun. I had to install a new HD in my Mac. Since Lion was out and I was still on Snow Leopard, I figured I might as well upgrade that too. I downloaded and burned it on a dvd. I figured, After swapping out the hard drive, I could install from DVD. Unfortunately, the DVD didn’t read. Damn! It was a pain to swap the disks and I didn’t want to do it again. So I tried booting from USB – attached the old disk to a usb enclosure and it booted! Linux couldn’t do that! Windows couldn’t do that! This was awesome. From there, I was able to just install Lion via the downloaded dmg file and pointed the install to the newly installed disk.

By the way, trying to burn a dmg file on Linux or Windows is a pain in the ass. I tried with both and gave up after about an hour of google searches and trying different converter products.

apt-get cheatsheet




nixCraft » Debian Linux apt-get package management cheat sheet » Print


– nixCraft – http://www.cyberciti.biz/tips

Debian Linux apt-get package management cheat sheet

Posted By LinuxTitli On May 9, 2005 @ 12:21 pm In Debian Linux, Howto, Linux, Sys admin, Tips, Ubuntu Linux | 6 Comments

[1]

Both Debian and Ubuntu Linux provides a number of package management tools. This article summaries package management command along with it usage and examples for you.

(1) apt-get : APT is acronym for Advanced Package Tool. It supports installing packages over internet (ftp or http). You can also upgrade all packages in single operations, which makes it even more attractive.

(2) dpkg : Debian packaging tool which can be use to install, query, uninstall packages.

(3) Gui tools:

You can also try GUI based or high level interface to the Debian GNU/Linux package system. Following list summaries them:
(1) aptitude [2]: It is a text-based interface to the Debian GNU/Linux package system.
(2) synaptic [3]: GUI front end for APT

Red hat Linux package names generally end in .rpml similarly Debian package names end in .deb, for example:
apache_1.3.31-6_i386.deb

apache : Package name
1.3.31-6 : Version number
i386 : Hardware Platform on which this package will run (i386 == intel x86 based system)
.deb : Extension that suggest it is a Debian package

Remember whenever I refer .deb file it signifies complete file name, and whenever I refer package name it must be first part of .deb file. For example when I refer to package sudo it means sudo only and not the .deb file i.e. sudo_1.6.7p5-2_i386.deb. However do not worry you can find out complete debian package list with the following command:

apt-cache search {package-name}

apt-get add a new package

Add a new package called samba
Syntax: apt-get install {package-name}

# apt-get install samba

apt-get remove the package called samba but keep the configuration files

Syntax: apt-get remove {package-name}

# apt-get remove samba

apt-get remove (erase) package and configuration file

Syntax: apt-get –purge remove {package-name}

# apt-get --purge remove samba

apt-get Update (upgrade) package

Syntax: apt-get upgrade

To upgrade individual package called sudo, enter:
# apt-get install sudo

apt-get display available software updates

Following command will display the list of all available upgrades (updates) using -u option, if you decided to upgrade all of the shown packages just hit ‘y’

# apt-get upgrade samba

However if you just wish to upgrade individual package then use apt-get command and it will take care of rest of your worries:
Syntax: apt-get install {package-name}

dpkg command to get package information such as description of package, version etc.

Syntax: dpkg –info {.deb-package-name}

# dpkg --info sudo_1.6.7p5-2_i386.deb | less

List all installed packages

Syntax: dpkg -l

# dpkg -l

To list individual package try such as apache

# dpkg -l apache

You can also use this command to see (verify) if package sudo is install or not (note that if package is installed then it displays package name along with small description):

# dpkg -l | grep -i 'sudo'

To list packages related to the apache:

# dpkg -l '*apache*'

List files provided (or owned) by the installed package (for example what files are provided by the installed samba package)
Syntax: dpkg -L {package-name}

# dpkg -L samba

(H) List files provided (or owned) by the package (for example what files are provided by the uninstalled sudo package)

Syntax: dpkg –contents {.deb-package-name}

# dpkg --contents sudo_1.6.7p5-2_i386.deb

Find, what package owns the file /bin/netstat?

Syntax: dpkg -S {/path/to/file}

# dpkg -S /bin/netstat

Search for package or package description

Some times you don’t know package name but aware of some keywords to search the package. Once you got package name you can install it using apt-get -i {package-name} command:
Syntax: apt-cache search “Text-to-search”

Find out all the Debian package which can be used for Intrusion Detection

# apt-cache search "Intrusion Detection"

Find out all sniffer packages

# apt-cache search sniffer

Find out if Debian package is installed or not (status)

Syntax: dpkg -s {package-name} | grep Status

# dpkg -s samba| grep Status

List ach dependency a package has…

Display a listing of each dependency a package has and all the possible other packages that can fulfill that dependency. You hardly use this command as apt-get does decent job fulfill all package dependencies.

Syntax: apt-cache depends package

Display dependencies for lsof and mysql-server packages:

# apt-cache depends lsof
# apt-cache depends mysql-server

Further reading


Article printed from nixCraft: http://www.cyberciti.biz/tips

URL to article: http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html

URLs in this post:

[1] Image: http://www.cyberciti.biz/tips/category/debian-linux

[2] aptitude: http://www.cyberciti.biz/images/blogs/tips_tricks/aptitude030505.jpg

[3] synaptic: http://www.cyberciti.biz/images/blogs/tips_tricks/synaptic.png

[4] cheat sheet: http://www.cyberciti.biz/howto/question/linux/dpkg-cheat-sheet.php

[5] cheat-sheet: http://www.cyberciti.biz/howto/question/linux/apt-get-cheat-sheet.php

[6] APT and Dpkg Quick Reference Sheet: http://www.cyberciti.biz/tips/ref/apt-dpkg-ref.html

Copyright © 2004-2009 nixCraft. All rights reserved.



pkgs to install in Ubuntu for Apache …

This is just for reference so that I know which packages I installed to get php navigator working. I’ll uninstall all of them if I ever need to remove it.

apache2-mpm-prefork defoma fontconfig-config libapache2-mod-php5 libfontconfig1 libfreetype6 libgd2-xpm libjpeg62 libpng12-0
libt1-5 libx11-6 libx11-data libxau6 libxdmcp6 libxml2 libxpm4 php5-common php5-gd ttf-dejavu ttf-dejavu-core ttf-dejavu-extra
x11-common apache2 apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1 libpcre3 libpq5 libdbd-mysql-perl libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl mysql-client-5.0 mysql-server
mysql-server-5.0      apache2-mpm-prefork libapache2-mod-php5 libxml2 php5 php5-common
defoma fontconfig-config libfontconfig1 libfreetype6 libgd2-xpm libjpeg62 libpng12-0 libt1-5 libx11-6 libx11-data libxau6
libxdmcp6 libxpm4 php5-gd ttf-dejavu ttf-dejavu-core ttf-dejavu-extra x11-common php5-mysql