Queue utility

From WikiDotMako
Revision as of 20:18, 30 December 2008 by Benjamin Mako Hill (talk | contribs) (New page: I (or someone else) should create a simple UNIX command (like for more utils) that takes a list of items (data separated separated by newlines or, with a "-0" option, by null characters). ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I (or someone else) should create a simple UNIX command (like for more utils) that takes a list of items (data separated separated by newlines or, with a "-0" option, by null characters). The command would then operate using these as arguments one at a time (or more in parallel, by option).

So, if you copy many files from a mounted data source but only one at a time, you could easily queue them up with commands like

% queue rsync host:file1 directory
% queue rsync host:file2 directory2
% queue rsync host:file3 directory

The first command would start rsync copying the file. When that command is finished, queue will check to see if there are more queued commands. If there are commands in the queue, it will proceed to run them.

Implementation[edit]

This should be able to work with a lock file that contains data on the files. There should be some means by which files do not edit/add to this at the same time. Opening a socket may be an effective way to both access the file and to determine if three is a running version of the command.