<div dir="auto">This is a nice mini-presentaion. Thanks. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat., Feb. 8, 2020, 1:49 a.m. Chris Frey, <<a href="mailto:cdfrey@foursquare.net">cdfrey@foursquare.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've been wanting a tool like this for so long, that when I found it<br>
recently, I felt I had to share it.<br>
<br>
On Debian systems it is packaged as task-spooler, as command line 'tsp'.<br>
<br>
Have multiple long running processes you want to throw in the background,<br>
but run them sequentially so they don't overload your system?<br>
<br>
$ cd project1<br>
$ tsp make<br>
$ cd ~/project2<br>
$ tsp make<br>
$ cd ~/project3<br>
$ tsp build-docker-image.sh<br>
<br>
Using tsp by itself gives you a summary of what's going on (contrived<br>
example using sleep):<br>
<br>
$ tsp<br>
ID State Output E-Level Times(r/u/s) Command [run=1/1]<br>
0 running /tmp/ts-out.uhS6Kv sleep 3m<br>
1 queued (file) sleep 4m<br>
2 queued (file) sleep 2m<br>
<br>
Want to watch the output for a while on the running process? Here's tail -f<br>
style behaviour on task 0:<br>
<br>
$ tsp -t 0<br>
<br>
The whole log?<br>
<br>
$ tsp -c 0 |less<br>
<br>
Want to kill it?<br>
<br>
$ tsp -k 0<br>
<br>
What if you have a beefier system than most and want to have multiple<br>
running slots? 4 CPUs? Let's open 3 slots:<br>
<br>
$ tsp -S 3<br>
<br>
Now 3 tasks can run at once.<br>
<br>
Want to have different queues for different purposes?<br>
<br>
$ alias tsdisk='TS_SOCKET=/tmp/socket.disk tsp'<br>
$ alias tsram='TS_SOCKET=/tmp/socket.ram tsp'<br>
$ alias tsnet='TS_SOCKET=/tmp/<a href="http://socket.net" rel="noreferrer noreferrer" target="_blank">socket.net</a> tsp'<br>
<br>
$ tsdisk qemu-img convert -c ....<br>
$ tsnet scp backup.tar host:/var/backups/<br>
$ tsnet wget <a href="https://videohouse.example.com/movie.mp4" rel="noreferrer noreferrer" target="_blank">https://videohouse.example.com/movie.mp4</a><br>
<br>
Need notification something finished?<br>
<br>
$ (tsp -w 4 ; xmessage qemu-img convert complete) &<br>
<br>
Have an urgent task that needs to go to the head of the line?<br>
<br>
$ tsp make # job 5<br>
# later...<br>
$ tsp -u 5 # head of the queue<br>
<br>
Need to chain commands based on success?<br>
<br>
$ tsp /usr/local/bin/run-backups.sh # job 2<br>
$ tsp -D 2 scp /var/backups/today.tar.gz host:/var/backups<br>
<br>
It's a beautiful thing! :-)<br>
<br>
- Chris<br>
<br>
<br>
_______________________________________________<br>
kwlug-disc mailing list<br>
<a href="mailto:kwlug-disc@kwlug.org" target="_blank" rel="noreferrer">kwlug-disc@kwlug.org</a><br>
<a href="https://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org" rel="noreferrer noreferrer" target="_blank">https://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org</a><br>
</blockquote></div>