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.


# convert image to PDF 
# (this assumes the input isn't already a 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)"


# 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.

44 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:


  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:


  10. 123Togel Says:


  11. Riatoto Says:


  12. Champion4d Says:


  13. Visatogel Says:


  14. Dewanalo Says:


  15. Mentari4d Says:


  16. QQpokerceme Says:


  17. Zienpoker Says:


  18. Inulpoker Says:


  19. Hm88poker Says:


  20. Sarangdomino Says:


  21. Depodewa Says:


  22. Pokerbo Says:


  23. Genkpoker Says:


  24. Pokerhokibet88 Says:


  25. Divatogel Says:


  26. Pedia4d Says:


  27. Woke4d Says:


  28. Tiara4d Says:


  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:


  38. Ratudomino88 Says:


  39. Ratupoker88 Says:


  40. Maxpoker88 Says:


  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

Leave a Reply