Wormhole

While developing tools for StratOS, I wrote a nifty little program that I call "Wormhole," which uses the Linux kernel's inotify functionality to respond to filesystem events. More specifically, it watches a single directory and performs specified actions on any files that are moved into or written to the directory. Once the files are processed, the results are stored in another directory. The syntax is like this:

$ wormhole action entrance_directory exit_directory
where the action is either a program name or one of the built-in commands: --zip or --unzip. The program that is used as the action, must take two input arguments: an input file and an output directory. Wormhole expects the action to remove the input file from the entrance_directory as its final step. The simplest (very silly) example is:
$ wormhole mv /directory1/  /directory2/
In this example, the action is the move command, mv. Whenever a file is added to /directory1, it will automatically be moved to /directory2.

A more realistic use case would involve a script that performs some sort of useful operations on the files that enter the entrance_directory. Here's a slightly less silly example action:

#! /bin/bash

# pdf_append.sh - A command for adding new pages to a PDF file
# usage: pdf_append.sh input_image output_directory
# where input_image is an image file that can be processed with
# ImageMagick's convert command and output_directory contains
# exactly one PDF document.
# Note that this is a very fragile script for demonstration
# purposes only.

input_image=$1
output_dir=$2

# convert image to PDF 
# (this assumes the input isn't already a PDF)

input_pdf="$input_image.pdf"
convert $input_image $input_pdf

# get the name of the PDF being appended to.
# assumes there is exactly one PDF file in output_dir 

output_pdf="$(ls $output_dir/*.pdf)"

temp_pdf="${output_pdf/.pdf/-temp.pdf}"

# append the input_pdf to the end of the output_pdf

mv $output_pdf $temp_pdf

pdfunite $temp_pdf $input_pdf $output_pdf
# these tools would also work: 
# pdftk $temp_pdf $input_pdf cat output $output_pdf 
# pdfjoin $temp_pdf $input_pdf $output_pdf

# delete intermediate files:

rm $input_image $input_pdf $temp_pdf

Suppose I create directories in my current working direcotry, called in/ and out/. Inside of the out/ directory, I place a PDF document. I then execute wormhole, like this:
$ wormhole ./pdf_append.sh in out 
Now, if I save or move images into the in/ directory, they will automatically be appended to the PDF document in out/ as new pages.

Wormhole was initially developed to provide a means of automatically compressing and decompressing files before they are sent over a non-compressed network stream (specifically, NFS), so it has two built-in actions, --zip and --unzip. These actions currently use zlib to perform the compression, but they will eventually use the LZO compression library, due to its compression speed. The input and output directories are in RAM-backed, tmpfs file systems in order to minimize latency. The sender places files into one "mouth" of the wormhole and files are compressed and sent to the destination computer. The receiver watches the other mouth of the worm hole and decompresses files as they arrive.

The current version of Wormhole isn't written to be a proper daemon, but it can be cheaply "daemonized" using nohup and output redirection. For example:

$ nohup wormhole --zip /path/to/in /path/to/out 1> /dev/null 2>/dev/null &
The source for the version of Wormhole described above can be found here.

50 Responses to “Wormhole”

  1. Margaret S Says:

    Thank you for sharing the version of Wormhole. I'll try to figure out how it works.

  2. waqas junaid Says:

    linux kernel networking pdf is a book learned for Hierarchy of networking layers, Networking Data Structures, NAPI, Routing Subsystem, Receiving a packet, Sending a Packet, and Multipath routing. computersciencepdf.com/linux-kernel-networ...

  3. Check Cashing Says:

    Getting the money for checks, for instance, is a great deal simpler these days than it was previously. In the not so distant past, getting the money for checks implied anguishing long queues in banks.

  4. webstagram Says:

    Thank you for sharing the article. Glad to find this post.
    instagram search

  5. JordanSpave Says:

    nevermind

  6. billywelsh Says:

    I’m an academic writer who loves to bring smiles to people's face.

    Writing is what I do for a living and I am so passionate about this. I have worked with several organizations whose mission is to help people solve problems.
    I love traveling and have visited several countries in the past few years.
    I’m happy to have written several books that have contributed positively to the lives of many. My works are available in several parts of the world. And I’m currently working with companies that help people save energy. Being a part of this team has open more opportunities for me to excel as a writer. I have worked with different people and met many clients as a professional.
    I can handle any kind of writing project and provide nothing but the best. People come to me all the time to ask if I can solve their writing problems and I accept. I find pleasure in helping them to solve their problems as a writer.

    Professional Writer – Billy Welsh - Techwritersclub Team

  7. eesawalt Says:

    Hi Everybody
    Thanks for checking out my writing website . My name is Noah.
    I have worked a long time in this niche. My passion for writing started at a young age. I wrote short stories as a child and eventually went on to work with my school newspaper.
    This early tryst into news reporting eventually led me to academic writing. There is plenty of work for professional writers. I specialize in essays, but have the skills to do all types of academic writing.
    Contact me for more information about rates and a price quote. I’m looking forward to helping you.

    Academic Writer – Noah – Myessaypartner Confederation

  8. cynthianav Says:

    Thanks for stopping by my page! I’m Cynthia.
    Even though I jokingly credit my aunt for my writing talent, I know that it is a ability I have fostered from childhood. Though my aunt is a writer, I also started out young.
    I’ve always had a way with words, according to my favorite teacher . I was always so excited in history when we had to do a research writing assignment.
    Now, I help current learners achieve the grades that have always come easily to me. It is my way of giving back to students because I understand the obstacles they must overcome to graduate.

    Cynthia Nava – Professional Writer – Weuniteconference Corps

  9. Onetogel Says:

    Onetogel

  10. 123Togel Says:

    123Togel

  11. Riatoto Says:

    Riatoto

  12. Champion4d Says:

    Champion4d

  13. Visatogel Says:

    Visatogel

  14. Dewanalo Says:

    Dewanalo

  15. Mentari4d Says:

    Mentari4d

  16. QQpokerceme Says:

    QQpokerceme

  17. Zienpoker Says:

    Zienpoker

  18. Inulpoker Says:

    Inulpoker

  19. Hm88poker Says:

    Hm88poker

  20. Sarangdomino Says:

    Sarangdomino

  21. Depodewa Says:

    Depodewa

  22. Pokerbo Says:

    Pokerbo

  23. Genkpoker Says:

    Genkpoker

  24. Pokerhokibet88 Says:

    Pokerhokibet88

  25. Divatogel Says:

    Divatogel

  26. Pedia4d Says:

    Pedia4d

  27. Woke4d Says:

    Woke4d

  28. Tiara4d Says:

    Tiara4d

  29. Result Hk Tercepat Says:

    Result Hk Tercepat

  30. Live Hk Toto Says:

    Live Hk Toto

  31. Live Draw Sydney Says:

    Live Draw Sydney

  32. Live Sgp Tercepat Says:

    Live Sgp Tercepat

  33. Live Hk 6d Says:

    Live Hk 6d

  34. Prediksi Togel Says:

    Prediksi Togel Hari Ini

  35. Nonton Live Bola Says:

    Nonton Live Bola

  36. maciegrif Says:

    Hello and welcome to my blog . I’m Macie.
    I have always dreamed of being a writer but never dreamed I’d make a career of it. In college, though, I helped a fellow student who needed help. She could not stop telling me how well I had done. Word got around and someone asked me for writing help just a week later. This time they would pay me for my work.
    During the summer, I started doing research paper writing for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my writing skills to students.

    Professional Writer – Macie – Victordematha Company

  37. Pokerace77 Says:

    pokerace77

  38. Ratudomino88 Says:

    Ratudomino88

  39. Ratupoker88 Says:

    Ratupoker88

  40. Maxpoker88 Says:

    Maxpoker88

  41. cyrusam Says:

    Hello All
    Thanks for checking out my academic writing page . My name is Cyrus Amos.
    I have worked several years in this niche. My interest in writing started at a young age. I wrote journaled as a child and eventually went on to work with my school newspaper.
    This early tryst into journalism eventually led me to academic writing. There is plenty of work for skilled writers. I specialize in dissertations , but have the skills to do all types of academic writing.
    Email me for more information about rates and a price quote. I’m looking forward to helping you.

    Academic Writer – Cyrus Amos – //www.schoolratingsusa.com/]Schoolratingsusa Corps

  42. gretabrock Says:

    Hi guys, my name is Greta Brock!

    I`m a professional writer and I`m going to change your lifes on?e and for all
    Writing has been my passion since early childhood and now I cannot imagine my life without it.
    Most of my books were sold throughout Canada, USA, Old England and even India. Also I`m working with services that help people to save their time.
    People ask me "Mr, Greta Brock, I need your professional help" and I always accept the request, `cause I know, that only I can save their time!

    Academic Writer - Greta - Thescientistexpo Corps

  43. kaitlinmc Says:

    Welcome to my blog ,
    I’m Kyra.
    If you’ve ever been too busy and couldn’t finish a academic paper, then you’ve come to the right place. I assist students in all areas of the writing technique. I can also write the paper from start to finish.
    My career as a professional writer started during high school. After learning that I was very skilled in the field of academic writing, I decided to take it up as a profession.

    Professional Academic Writer- Kyra- Customwriters Team

  44. beverlypier Says:

    My name is Beverly. And I am a professional Content writer with many years of experience in writing.

    My main focus is to solve problems related to writing. And I have been doing it for many years. I have been with several associations as a volunteer and have assisted clients in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a passionate writer who started at an early age.
    I’m happy that I`ve already sold several copies of my books in different countries like USA, Russia and others too numerous to mention.
    I also work in a company that provides assistance to many people from different parts of the world. Students always come to me because I work no matter how complex their projects are. I help them to save money, because I feel happy when people come to me for professional help.

    Academic Writer – Beverly - Sergreport Team

  45. agatawhit Says:

    Hello everyone , I’m Agata.
    Welcome to my about page. I started writing in high school after a creative writing assignment for my English teacher. I did creative writing for several months before I thought about doing something else.
    I had always loved doing research assignments because I’m passionate about learning. When you combine writing ability with a love of learning, dissertation writing only makes sense as a job.
    I’m passionate about helping the students of the future in their school career. When they get too busy, I am there to help.

    Agata – Academic Writing Help - //www.hipdoghomestudy.com/]Hipdoghomestudy Band

  46. amieebern Says:

    Hello, it’s Amiee Bernard here!
    I work as a professional an essay writer and have created this content with the intent of changing your life for the better. I started honing my writing talent in college. I learned that my fellow students needed writing help—and they were willing to pay for it. The money was enough to help pay my tuition for my remaining semesters of college.
    Ever since high school, I have continued to work as an academic writer. I was hired by a writing service based in the United Kingdom. Since then, the research papers that I have created have been sold around Europe and the United States.
    In my line of work, I have become familiar with hearing, “Amiee Bernard, can you help me meet my writing assignment deadline?” I know that I can provide this service.

    Academic Writer – Amiee – Jenniferpalmerstudio Band

  47. lianaly Says:

    Hi, my name is Liana!

    I`m a professional writer and I`m going to change your lifes on?e and for all
    Writing has been my passion since early childhood and now I can`t imagine my life without it.
    Most of my books were sold throughout Canada, USA, China and even Australia. Also I`m working with services that help people to save their nerves.
    People ask me "Sir, Liana Lynn, I need your professional help" and I always accept the request, `cause I know, that only I can save their time!

    Professional Writer - Liana - Literaturematters Team

  48. sabrinar Says:

    Thanks for stopping by my page! I’m Sabrina.
    Even though I jokingly credit my grandmother for my writing talent, I know that it is a ability I have fostered from childhood. Though my grandmother is a writer, I also started out young.
    I’ve always had a way with words, according to my favorite professor . I was always so excited in history when we had to do a research writing assignment.
    Now, I help current students achieve the grades that have always come easily to me. It is my way of giving back to communities because I understand the obstacles they must overcome to graduate.

    Sabrina Russell – Academic Writing Professional – Check this Team

  49. lynseyvel Says:

    Good day and welcome to my website . I’m Lynsey.
    I have always dreamed of being a novelist but never dreamed I’d make a career of it. In college, though, I helped a fellow student who needed help. She could not stop complimenting me . Word got around and someone asked me for to help them just a week later. This time they would compensate me for my work.
    During the summer, I started doing research papers for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my research paper writing to students.

    Academic Writer – Lynsey – Mathhomeworkanswer Band

  50. hydrahip Says:

    ????????? ???????? ????? ????? ??? ??????????? GangBang shop ????? ??????? ????????? ????? ?????
    MEFOPT ????? ??????? ????????? ????? ?????
    ??????????? ??? ??????? ?????????????? ???????? ????? ????? ????? @hydraoniondeep
    ????? ?????? ????? ?????? ?? ???????
    ??? ? ???? ???????
    ?????? ??????? ?????? ?????? ????? ?????? ???????? ???????

    ?????? ????????? apvp
    hydraruzxpnew4af.onion/market/1173 Stuffman

Leave a Reply