aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rwxr-xr-xpool.sh20
2 files changed, 17 insertions, 6 deletions
diff --git a/README.md b/README.md
index 7ccb01f..f0a1d88 100644
--- a/README.md
+++ b/README.md
@@ -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
- 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>`
-- 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.
diff --git a/pool.sh b/pool.sh
index aa96cca..982635d 100755
--- a/pool.sh
+++ b/pool.sh
@@ -3,9 +3,12 @@ set -e
# Fetch arguments
CMD=$1
-POOL_ID=$2
-shift 2
-PROC_CMD=$@
+if [ $# -gt 1 ]
+then
+ POOL_ID=$2
+ shift 2
+ PROC_CMD=$@
+fi
# Config: feel free to change at your own risks
tmpdir=/tmp
@@ -104,6 +107,10 @@ cat_output() {
cat "$file"
}
+list_pool() {
+ find "${tmpdir}" -name "${pool_format}*" -exec basename {} \; 2>/dev/null | sed "s/${pool_format}//g"
+}
+
wait_pool() {
refresh
while [ $nproc -gt 0 ]
@@ -128,7 +135,7 @@ remove_force() {
}
# 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
case "$CMD" in
@@ -147,9 +154,12 @@ case "$CMD" in
[ $procid -gt $lastprocid ] && abort "Processus $procid not found"
cat_output
;;
- "ls")
+ "ls-output")
list_output
;;
+ "ls")
+ list_pool
+ ;;
"wait")
wait_pool
;;