Hi Jon, On Fri, Apr 15, 2016 at 10:29:24PM +0200, Jon S wrote: > > As a port of a backup solution, i needa a queue. Having looked around the > net, i haven found any standard way (besides named pipes) that I can use. >
Here's some shell scripting suggestions (which can be BASH specfic...) http://mywiki.wooledge.org/NamedPipes http://mywiki.wooledge.org/BashFAQ > Requirements are: > * There will be few elements in the queue (<20) > * No critical section is needed (this is already adressed using mkdir) > * The queue must be possible to examine without altering it > * It would be nice if the queue only can contain unique elements (no point > in queing the same job twice) > > My own two ideas are: > * Files in a dir. Gives uniqueness if names are well selected, but I dont > know how to handle element order neatly These might give you some ideas: http://mywiki.wooledge.org/BashFAQ/099 http://mywiki.wooledge.org/BashFAQ/003 With find(1) -newer [a touched timestamp file] and/or sort(1). > * Rows in a file: No guarantee for unique jobs. Easy to define order and to > add a new job at end (or beginning) of a file or pop a job > A bloated way to do that is with an SQLite database, with a table's unique primary key being some (job number) attribute. Another column could auto timestamp on row insertion, so you could query on job number or time added. Unless you've other data to retain, it is rather bloated. > Any ideas or proposal of standard way to do this? > Could the base batch(1) or at(1) tools do it well enough for you? On OpenBSD, you'll be using ksh, but there's a lot of ideas on the web with the search "bash queue" which might be useful starting ideas. Cheers! -- On-line, adj.: The idea that a human being should always be accessible to a computer.

