Synology NAS and those pesky @eaDir folders

CLI, Shell Script, synology
If you've enabled MediaServer and/or PhotoStation on your Synology NAS you might have noticed a bunch of "@eaDir" folders inside your data folders. You will not normally see this under samba or appletalk connections. I noticed it since I was trying to rsync from synology to a old qnap nas I have lying around. Although you can turn these services off from the Control Panel, it does not get rid of these dumb folders. So here is a quick script to clean all the "@eaDir" folders up from your synology disk. NOTE: I'VE INTENTIONALLY NOT USED THE "rm -rf" COMMAND HERE. I DON'T WANT YOU TO DESTROY YOUR NAS SERVER WITH JUST ONE COMMAND. Run the command below and it will "echo" the names of these "@eaDir" folders to the…
Read More

Basic APT commands

CLI, Linux, Shell Script, Ubuntu
Okay, now for a bit of CLI goodness. Here is a quick list of basic apt commands.  Debian and most derivatives (Ubuntu) use these for package maintenance.#searchapt-cache search packagename#package infoapt-cache show packagename#cleansudo apt-get cleansudo apt-get autoclean #old packages#checkapt-get check#get source codeapt-get source packagename#get depapt-get build-dep packagename#update/install/remove/upgradesudo apt-get updatesudo apt-get install packagenamesudo apt-get remove packagenamesudo apt-get upgradesudo apt-get dist-upgrade
Read More

OSX Webmaster special: Shared webserver, bad umask settings, group permissions and filenames with spaces…

Apple, CLI, Linux, Macintosh, OSX, Reference, Shell Script, Tricks, Tutorial, Ubuntu, Unix
Okay so this all started with our users not being able to share files on our webserver. We use SSH only for upload/download and interactive access (ie: no ftp). Through trial and error we found out that the default umask (under OSX Server) for sftp uploaded files are 0033 (ie: rwxr--r--) and directories are 0022 (ie: rwxr-xr-x). This creates a problem when one user uploads a file and another user downloads/modifies and tries to re-upload it -- they simply can't because the group permissions are wrong.If we were using ftp (which we are not) there are some solutions on the net that allow you to modify the startup parameters for the ftp server so that the default umask for all files is 0013 -- which would allow a group of…
Read More

Couple of cool remote ssh commands for your UNIX arsenal

CLI, Reference, Shell Script, Unix
Here is a easy way to copy an entire directory tree from one Unix machine to another, while retaining the permisssions and ownership, using ssh as the middle man. Assuming that you want to copy everything under source_directory to destination_directory on another machine here is the command you would issue on the source machine (first cd to the directory containing source_directory): tar -cf - source_directory/ | ssh "cd /somedir/destination_directory ; tar -xvlpf -" or if you want to copy everything from the remote server's source directory to the local machine's destination directory: ssh "(cd /somedir/source_directory ; tar -cf - .)" |(cd /somedir/destination_directory ; tar -xvlf -) Here is another similar command that allows you to backup a HD partition to another host via ssh: dd bs=1M if=/dev/sdb |…
Read More

Couple of quick shell tips

CLI, Shell Script
Okay these are bash goodies, so they'll work in any environment. If you're in a situation where you're switching between two different directory paths over and over again, here is a quick tipcd - Another little annoyance that I've gotten around is when you want to edit a system file and you type in the command (ie: vi /etc/this/is/a/really/long/path/config.cfg), only to realize that you forgot to sudo. This used to mean that I would quit vi, curse, recall the command, insert a sudo infront of the vi command and try again....well here is the quicker way.sudo !!This will (re)sudo your last command. And if that's not enough you can actually narrow the sudo down to the last command that started with a certain string.sudo !apacheWhich will look in the history…
Read More

Generic Scripts to add Google Analytics code to HTML pages

Analytics, Google, Shell Script
Before I start, this tip is Unix friendly (not just OSX), but requires you to know what shell scripts are and how you create/run them. Additionally you should be familiar with the workings of the "find" command in Unix.I had lots of trouble getting the Google Analytics code onto my gallery site. The problem is that I use iWeb to create a front end that links to a discrete back end (ie: specific subdirectories generated by Photoshop, iPhoto or Aperture). I found this Automator script earlier, but it seems like every time I run the script on a Folder, the script only changes .html pages created by iWeb....Weird. So after some head scratching and googling, I found the following complementary scripts on RSVP - Xnews site. There is a certain…
Read More