Kicking off background jobs over SSH

I needed this information yesterday, as I was trying to use SSH from one machine to start a shell script running in the background on another.

You’re probably using the OpenSSH server, and started a background process on the server which you intended to continue after logging out of the SSH session. Fix: redirect the background process stdin/stdout/stderr streams (e.g. to files, or /dev/null if you don’t care about them).

Works perfectly. So, not this:

ssh remotehost "script.sh &"

but this:

ssh remotehost "nohup script.sh < /dev/null >script.out 2>script.err &"

This is also needed for pssh.

pssh -h remotehosts.txt "nohup script.sh < /dev/null >script.out 2>script.err &"

Programming Font: Inconsolata

Time for another of my favorite programming fonts: Inconsolata.

Inconsolata specimen

Inconsolata specimen from fontsquirrel.com.

As its creator states, it bears a resemblance to the Consolas font that ships with more recent Windows versions, and which isn’t all that bad either. This one has a bit of an edge in my opinion: it’s freely available so I’m good to go on my Mac with it.

It’s a bit sharper and bolder than Droid Sans Mono, and the letters are a bit more spaced out. So, based on your mood, I could see using either one. For some reason it also reminds me warmly of the monospaced font Sun would use in their old Java books in the 90’s – probably Vera Sans Mono.

From Dropbox to BitTorrent Sync

I’ve been a fan of Dropbox for years, mainly due to how dead-simple it is to use and how well It Just Works. Lately, Amazon and Google have been trying to move in on the cloud storage game with their own offerings, and of course there’s Box, Ubuntu One, and other systems already competing. Obviously, the ability to sync files across your machines is super-handy.

My main problem with Dropbox has always been how little space you can get. Right now I have 4.42 GB of space in my personal account, over and above the standard free amount due to several referrals and uploading photos and trying Dropquest 2012. It’s a decent amount of space, but … Google Drive kicks you off with 15 GB right away, and Amazon even starts at 5 GB. Box starts you with 10 GB. Dropbox still starts you with just 2 GB.

I would have figured that Dropbox would start bumping things up with the growing competition, but instead their latest announcement was for some sort of photo gallery thing. I mean, I guess they have the whole file sync thing down pat so they need to branch out, but I don’t get how a gallery app is a logical next step. I really want more gigabytes. I could start using the storage in new broad ways.

A while back a friend of mine had me set up BitTorrent Sync in order to transfer some files. Unlike all of those other systems I mentioned, this one has no central server. Instead, your files are shared democratically across all computers you have linked using the same shared secret. As a bonus, all files are encrypted during transport, so that plus the lack of a central server means your files are better protected from anyone who might like to see them without your permission. That’s all fine and good, but what I really care about is that the space is unlimited, since you bring the storage.

So, I’m transitioning from Dropbox to BT Sync. Right now I have two Dropbox accounts, one for work and one for personal use. I’ll have the work one switched over relatively quickly, and the personal one before much longer. I’ll leave the personal one alive for a few isolated items, and as an alternative for cases where BT Sync isn’t as convenient (e.g., web access). Plus, I worked hard for those extra 2.42 GB, dangit.

I have an Ubuntu machine at home, and I installed BT Sync there to take the place of the central server in my scheme. If nothing else, it serves as a backup location for the files in my Sync folders. Although the system really doesn’t need an anchor like that, it helps me transition over. A better option would be to sync to a trusted friend’s systems, which would give me offsite backup. If there were a way to encrypt those copies, it’d be just about perfect.

Finally trying a text expander

Being a code monkey, I can type pretty fast. More importantly, I can type naturally, just expressing my thoughts without thinking so much about where my fingers go. It’s the same as when you get good enough at driving that you don’t think about turning the wheel or pushing pedals, you just drive. Martial artists develop the same union with weaponry; the sword becomes an extension of themselves, connected to their center and not a separate entity.

Anyway … I’ve gotten to the point where I prefer to retype something than to try to save keystrokes by retrieving it from, say, my shell history, or by copying and pasting. It interrupts the flow, makes me think about the tool again. By the time I’d mentally work out the “more efficient” method, I could just have retyped it, wasting keystrokes but staying in the flow.

I use a set of software to help keep me flowing and efficient, stuff like Quicksilver and Fluid. But I haven’t used another time saver, a text expander, until the past couple of weeks. A text expander watches what you type and replaces it on the fly, so you can just type “tyvm” and presto, it turns into “thank you very much”. Sounds like a no-brainer to add to my toolset, but I was reluctant to bother since I could just type instead.

So what changed? I think it has been working on Accumulo. That is a tough word to type. Even after these few months with it, it can still tangle my fingers. So, after consulting Lifehacker I gave aText a shot. So, now when I type “accm” I get “accumulo” substituted. “Accm” becomes “Accumulo” and “ACCM” becomes “ACCUMULO”. Yes, I need all three cases. As a bonus, I configured it to make a satisfying pop whenever it expands. a-c-c-m *pop*

Just yesterday I added “SNPS” for SNAPSHOT, since I work with Maven all the time. I suppose that now that I have the tool on hand I’ll start to notice more and more places where it makes sense to use it. I intend to use it only in narrow circumstances, and rely on more traditional – and portable – shortcuts like shell aliases and code editor snippets (ah, Sublime Text) for the majority of cases.

There’s an art to defining expansions. Your abbreviated form has to be something unique and unambiguous, or else you’ll get the expansion when you don’t want it. If I just used “acc” for “accumulo”, I couldn’t write “accept” or “accelerate”.

There is still the extra thought involved right now, remembering that I have the option to type less. Still, I can just write the words out and not worry about it. With time and practice, I expect that I’ll remember to use the tool more often, and the mental speed bump will fade away.

One thing I worry about is that I’ll get too used to the tool, and when I’m on a machine without it, I’ll have to un-remember to use it, and work through another mental speed bump. We’ll see if that becomes an issue. For now, I’ve ponied up the five bucks and added it to the family.

Programming Font: Droid Sans Mono

I have to admit that I like fonts. I’m one of those oddballs who knows about serifs and x-heights and descenders and kerning and autoligatures and all those sorts of things. I’ve never designed my own font, but I know what I like, and since I spent a lot of time coding and staring at terminals, I definitely know what I like to use for those purposes. Over the years I’ve had different font preferences, and I’d like to periodically post about some that I like now or used to like.

The first one on my list is what I use for my iTerm2 window: Droid Sans Mono.

Droid Sans Mono specimen

Droid Sans Mono specimen from fontsquirrel.com.

It doesn’t have as many sharp corners as other popular monospaced fonts, and the letter spacing is also much bigger, which helps keep commands from running together at the prompt. The lowercase letters are nice and big compared to the capital letters (that is, the font has a nice, big x-height), which makes for easier reading at smaller sizes (which I avoid anyway, my vision is bad enough already.)