diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-08-21 18:24:45 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-08-21 18:24:45 +0200 |
| commit | 550b99022ba9b79071f76a9122ff93bd78442d7c (patch) | |
| tree | ae0d4e928e41f7d940b2e2ed8e67765085a6dd0b | |
| parent | 54652db0079945faf378f949fb45914eb629eb8d (diff) | |
Improve listing api
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | pool.sh | 20 |
2 files changed, 17 insertions, 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 - 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. @@ -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 ;; |
