I am a huge believer in the Unix philosophy. Small, composable modules, loosely coupled. If you know your way around a Un*x system, you need little else. Here’s an example. I’ve got an NFS volume on a server and I wanted to backup (1)
all the content to USB drives automatically, every hour. I decided to use the rsync program to do differential backups, but ran into an issue. My server is on a UPS, but the USB enclosure is not. So at times, after a power failure, the USB drives aren’t available and rsync (2)
tries to back everything to the /media folder by creating a new local folder instead of writing to the mounted USB drive. I figured I’d resolve this by checking that both my USB drives were mounted before I ran the rsync backup command. Here’s one solution: (3)
A few things to say here. First, I didn’t have to use a programming language. Bash shell script was sufficient. Second, notice how that variable x is assigned; I’m getting the output of the mount command, filtering the relevant drives, numbering them & finally extracting the (4)
last line as a count. This approach lets me combine many small command line programs and assign their composed output to a simple variable. Third, I can then use bash conditionals to determine what to do next. Last, rsync is an awesome CLI program that can do remote and (5)
local backups. This is just one of tons of super amazing, solid programs that come with most Un*x distros. A few lines of Bash and voila! Problem solved. And when it comes to automating execution, a single line in the cron scheduler runs the backup process every hour. (6)
And what’s more, you can do all this remotely from a phone, thanks to ssh. I love the flexibility & control Un*x provides. It’s a true testament to the Unix design philosophy that this operating system doesn’t just continue to be relevant, it literally runs the world. (End)

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Amir Husain

Amir Husain Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @amirhusain_tx

22 Apr
I’m bullish on Bitcoin but my reasons are very different from what you might have heard elsewhere. My conviction has to do with what I’ve learned as a student of technology history and my discovery of a class of “resonant ideas” that are eventually guaranteed to succeed. (1)
You see, there are certain persistent desires & dreams we humans have; things we need technology to do for us. And we don’t give up until we get them, even across generations. Why? Perhaps, as a species we have some deep seated urges we can only achieve through technology? (2)
Some of these desires appear in legends or stories from millennia ago. Some, in more recent science fiction. They are then seeded in the consciousness of practitioners and engineers of every generation until the science and technology that can realize them, comes to be. (3)
Read 16 tweets
3 Oct 20
A couple of weeks ago, I started reading @stephen_wolfram's new book, "A Project to Find the Fundamental Theory of Physics". I have enjoyed it. But, my enjoyment of the book has nothing at all to do (1/6)
with whether or not it indeed points us to a fundamental (or any) theory of physics*. Instead, the pleasure I derived comes from seeing visual manifestations of the ideas of emergence; complexity from simplicity, the power of computation and of generative construction ... (2/6) Image
that are captured in beautiful pictures throughout the volume.

Rather than simply read, I wanted to experiment with the ideas in the book. The examples, as in all Wolfram writings, were created with Mathematica. (3/6) Image
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(