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