author | viric <viriketo@gmail.com> |
Wed, 19 Oct 2016 22:09:02 +0200 | |
changeset 351 | 69b9bbe171c6 |
parent 278 | 1698b327528d |
permissions | -rw-r--r-- |
57 | 1 |
System wide queue |
2 |
------------------------- |
|
79 | 3 |
You can set the $TS_SOCKET variable to the same name path for all your |
4 |
'ts' processes, and then |
|
57 | 5 |
they'll use the same socket for intercommunication. This means - single queue. |
6 |
You should be certain that any 'ts' can read/write to that socket, using |
|
79 | 7 |
chmod. |
8 |
||
9 |
||
10 |
A queue for each resource |
|
11 |
------------------------- |
|
12 |
You can use $TS_SOCKET and aliases/scripts for having different queues for |
|
13 |
different resources. For instance, using bash: |
|
14 |
alias tsdisk='TS_SOCKET=/tmp/socket.disk ts' |
|
15 |
alias tsram='TS_SOCKET=/tmp/socket.ram ts' |
|
16 |
alias tsnet='TS_SOCKET=/tmp/socket.net ts' |
|
57 | 17 |
|
165
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
18 |
You can also create shell scripts like this: |
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
19 |
<< FILE ts2 |
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
20 |
#!/bin/sh |
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
21 |
export TS_SOCKET=/tmp/socket-ts2.$USER |
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
22 |
ts "$@" |
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
23 |
>> END OF FILE ts2 |
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
24 |
|
57 | 25 |
|
26 |
Be notified of a task finished |
|
27 |
------------------------- |
|
28 |
In X windows, inside bash, after submitting the task, I use: |
|
29 |
$ ( ts -w ; xmessage Finished! ) & |
|
165
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
30 |
|
7b914d4003c2
Fixing licenses in some files, and updating some documents.
viric@mandarina
parents:
79
diff
changeset
|
31 |
|
183
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
32 |
Killing process groups |
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
33 |
------------------------- |
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
34 |
ts creates a new session for the job, so the pid of the command run can be |
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
35 |
used as the process group id for the command and its childs. So, you can use |
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
36 |
something like: |
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
37 |
$ kill -- -`ts -p` |
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
38 |
in order to kill the job started and all its childs. I find it useful when |
95d49e8a8cec
Updating 'help' and some other related files to 0.5
viric@llimona
parents:
165
diff
changeset
|
39 |
killing 'make's. |
278 | 40 |
|
41 |
||
42 |
Limiting the number of ts processes |
|
43 |
------------------------- |
|
44 |
Each queued job remains in the system as a waiting process. On environments |
|
45 |
where the number of processes is quite limited, the user can select the amount |
|
46 |
of the maximum number of ts server connections to ts clients. That will be |
|
47 |
read from the environment variable TS_MAXCONN at the server start, and cannot be |
|
48 |
set again once the server runs: |
|
49 |
$ ts -K # we assure we will start the server at the next ts call |
|
50 |
$ TS_MAXCONN=5 ts |
|
51 |
Internally there is a maximum of 1000 connexions that cannot be exceeded without |
|
52 |
modifying the source code (server.c). |