[kwlug-disc] command line fans: task-spooler

Paul Nijjar paul_nijjar at yahoo.ca
Sun Feb 9 18:05:04 EST 2020


I think it is worth submitting to a magazine, actually. This is
excellent.

- Paul

On Sun, Feb 09, 2020 at 04:30:16PM -0500, John Van Ostrand wrote:
> 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
> >

> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> https://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org


-- 
Events: https://feeds.off-topic.kwlug.org 
Blog: http://pnijjar.freeshell.org




More information about the kwlug-disc mailing list