Necessity is truly the mother of invention. I was working from the Isle of Man recently, and really, really enjoyed my stay! There's no better description for the Isle of Man than "quaint":
quaintThough that description applies to the Internet connectivity, as well :-) Truth be told, most hotel WiFi is pretty bad. But nestle a lovely little old hotel on a forgotten little Viking/Celtic island and you will really see the problem exacerbated.
kwānt/
adjective1. attractively unusual or old-fashioned.
"quaint country cottages"
synonyms: picturesque, charming, sweet, attractive, old-fashioned, old-world
I worked around most of my downstream issues with a couple of new extensions to the run-oneproject, and I'm delighted as always to share these with you in Ubuntu's package!
As a reminder, the run-one package already provides:
- run-one COMMAND [ARGS]
- This is a wrapper script that runs no more than one unique instance of some command with a unique set of arguments.
- This is often useful with cronjobs, when you want no more than one copy running at a time.
- run-this-one COMMAND [ARGS]
- This is exactly like run-one, except that it will use pgrep and kill to find and kill any running processes owned by the user and matching the target commands and arguments.
- Note that run-this-one will block while trying to kill matching processes, until all matching processes are dead.
- This is often useful when you want to kill any previous copies of the process you want to run (like VPN, SSL, and SSH tunnels).
- keep-one-running COMMAND [ARGS]
- This command operates exactly like run-one except that it respawns the command with its arguments if it exits for any reason (zero or non-zero).
- This is useful when you want to ensure that you always have a copy of a command or process running, in case it dies or exits for any reason.
Newly added, you can now:
- run-one-constantly COMMAND [ARGS]
- This is simply an alias for keep-one-running.
- I've never liked the fact that this command started with "keep-" instead of "run-one-", from a namespace and discoverability perspective.
- run-one-until-success COMMAND [ARGS]
- This command operates exactly like run-one-constantly except that it respawns "COMMAND [ARGS]" until COMMAND exits successfully (ie, exits zero).
- This is useful when downloading something, perhaps using wget --continue or rsync, over a crappy hotel WiFi connection.
- run-one-until-failure COMMAND [ARGS]
- This command operates exactly like run-one-constantly except that it respawns "COMMAND [ARGS]" until COMMAND exits with failure (ie, exits non-zero).
- This is useful when you want to run something until something goes wrong.
I am occasionally asked about the difference between these tools and the nohup command...
- First, the "one" part of run-one-constantly is important, in that it uses run-one to protect you from running more than one instances of the specified command. This is handy for something like an ssh tunnel, that you only really want/need one of.
- Second, nohup doesn't rerun the specified command if it exits cleanly, or forcibly gets killed. nohup only ignores the hangup signal.
So you might say that the run-one tools are a bit more resilient than nohup.
You can use all of these as of Ubuntu 13.10 (Saucy), by simply:
sudo apt-get install run-one
Or, for older Ubuntu releases:
sudo apt-add-repository ppa:run-one/ppa
sudo apt-get update
sudo apt-get install run-one
Happy running,
:-Dustin