TRICKS
author viric@mandarina
Fri, 02 Oct 2009 19:20:41 +0200
changeset 274 62048132f95f
parent 269 56061026d168
child 278 1698b327528d
permissions -rw-r--r--
Making changes so it looks like the code in ts-0.6.4, which I can't find

System wide queue
-------------------------
You can set the $TS_SOCKET variable to the same name path for all your
'ts' processes, and then
they'll use the same socket for intercommunication. This means - single queue.
You should be certain that any 'ts' can read/write to that socket, using
chmod.


A queue for each resource
-------------------------
You can use $TS_SOCKET and aliases/scripts for having different queues for
different resources. For instance, using bash:
alias tsdisk='TS_SOCKET=/tmp/socket.disk ts'
alias tsram='TS_SOCKET=/tmp/socket.ram ts'
alias tsnet='TS_SOCKET=/tmp/socket.net ts'

You can also create shell scripts like this:
<< FILE ts2
#!/bin/sh
export TS_SOCKET=/tmp/socket-ts2.$USER
ts "$@"
>> END OF FILE ts2


Be notified of a task finished
-------------------------
In X windows, inside bash, after submitting the task, I use:
$ ( ts -w ; xmessage Finished! ) &


Killing process groups
-------------------------
ts creates a new session for the job, so the pid of the command run can be
used as the process group id for the command and its childs. So, you can use
something like:
$ kill -- -`ts -p`
in order to kill the job started and all its childs. I find it useful when
killing 'make's.