


Still, any user on the system can launch run-one jobs, and their own command+arguments namespace is unique to them. Turns out I was wrong about that, per a set of recently added features to Upstart (thanks, James, and Stuart for pointing out!), non-root users can now write and run their own upstart jobs. Can a non-root user write their own upstart job, and start and stop it? Not that I can tell (and I'm happy to be corrected here). An upstart job typically runs at boot time, or when "started" using the start command, and these start jobs located in the root-writable /etc/init/.You can certainly use run-one and friends inside of a script, but they're typically used in an interactive shell command line. The run-one commands are simply prepended onto the beginning of any command line program and arguments you want to run. On my system the average upstart job is 25 lines long. You can see many examples in Ubuntu's /etc/init/*.conf. An upstart job is defined by its own script-like syntax.That said, I think the differences between upstart and run-one are certainly different enough to merit both tools, at least on my servers. In fact, I've used respawn in several of the upstart jobs I've written for the Ubuntu server, so I'm happy to credit upstart's respawn for the idea. It has a really cool feature/command/option called respawn, which can be used to provide a very similar effect as run-one-constantly. It's typically used to start daemons and other scripts, utilities, and "jobs" at boot time. Upstart is Ubuntu's event driven replacement for sysvinit. I was also asked about the difference between these tools and upstart. 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.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 often useful when you want to kill any previous copies of the process you want to run (like VPN, SSL, and SSH tunnels).Note that run-this-one will block while trying to kill matching processes, until all matching processes are dead.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.This is often useful with cronjobs, when you want no more than one copy running at a time.This is a wrapper script that runs no more than one unique instance of some command with a unique set of arguments.
