Improve listing api
This commit is contained in:
parent
54652db007
commit
550b99022b
2 changed files with 17 additions and 6 deletions
|
@ -11,6 +11,7 @@
|
||||||
- Force the removal of a pool with `./pool.sh remove-force <poolname>` all running processes will be killed and the pool will be deleted
|
- Force the removal of a pool with `./pool.sh remove-force <poolname>` all running processes will be killed and the pool will be deleted
|
||||||
- Additional properties can be attach to processes with `./pool.sh setp <poolname> <procid> <propname> <propvalue>` Defaults properties are `<cmd>`,`<procpid>`,`<startat>`.
|
- Additional properties can be attach to processes with `./pool.sh setp <poolname> <procid> <propname> <propvalue>` Defaults properties are `<cmd>`,`<procpid>`,`<startat>`.
|
||||||
- Properties can be retrieve with `./pool.sh getp <poolname> <procid> <propname>`
|
- Properties can be retrieve with `./pool.sh getp <poolname> <procid> <propname>`
|
||||||
- Finally, all the processes output file can be retrieve with `./pool.sh ls <poolname>`
|
- Available pools can be retrieve with `./pool.sh ls`
|
||||||
|
- All the processes output file can be retrieve with `./pool.sh ls-output <poolname>`
|
||||||
|
|
||||||
**Finale quote:** No checks are performed on the pool.sh arguments. Be sure to use the right ones. Defaults configuration requires access to the `/tmp` directory.
|
**Finale quote:** No checks are performed on the pool.sh arguments. Be sure to use the right ones. Defaults configuration requires access to the `/tmp` directory.
|
||||||
|
|
20
pool.sh
20
pool.sh
|
@ -3,9 +3,12 @@ set -e
|
||||||
|
|
||||||
# Fetch arguments
|
# Fetch arguments
|
||||||
CMD=$1
|
CMD=$1
|
||||||
POOL_ID=$2
|
if [ $# -gt 1 ]
|
||||||
shift 2
|
then
|
||||||
PROC_CMD=$@
|
POOL_ID=$2
|
||||||
|
shift 2
|
||||||
|
PROC_CMD=$@
|
||||||
|
fi
|
||||||
|
|
||||||
# Config: feel free to change at your own risks
|
# Config: feel free to change at your own risks
|
||||||
tmpdir=/tmp
|
tmpdir=/tmp
|
||||||
|
@ -104,6 +107,10 @@ cat_output() {
|
||||||
cat "$file"
|
cat "$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_pool() {
|
||||||
|
find "${tmpdir}" -name "${pool_format}*" -exec basename {} \; 2>/dev/null | sed "s/${pool_format}//g"
|
||||||
|
}
|
||||||
|
|
||||||
wait_pool() {
|
wait_pool() {
|
||||||
refresh
|
refresh
|
||||||
while [ $nproc -gt 0 ]
|
while [ $nproc -gt 0 ]
|
||||||
|
@ -128,7 +135,7 @@ remove_force() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure pool exists
|
# Ensure pool exists
|
||||||
[ ! "$CMD" == "create" ] && [ ! -d "$pool" ] && abort "Pool $POOL_ID not found"
|
[ ! "$CMD" == "create" ] && [ ! "$CMD" == "ls" ] && [ ! -d "$pool" ] && abort "Pool $POOL_ID not found"
|
||||||
|
|
||||||
# Launch command
|
# Launch command
|
||||||
case "$CMD" in
|
case "$CMD" in
|
||||||
|
@ -147,9 +154,12 @@ case "$CMD" in
|
||||||
[ $procid -gt $lastprocid ] && abort "Processus $procid not found"
|
[ $procid -gt $lastprocid ] && abort "Processus $procid not found"
|
||||||
cat_output
|
cat_output
|
||||||
;;
|
;;
|
||||||
"ls")
|
"ls-output")
|
||||||
list_output
|
list_output
|
||||||
;;
|
;;
|
||||||
|
"ls")
|
||||||
|
list_pool
|
||||||
|
;;
|
||||||
"wait")
|
"wait")
|
||||||
wait_pool
|
wait_pool
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue