aboutsummaryrefslogtreecommitdiff
path: root/pool.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pool.sh')
-rwxr-xr-xpool.sh20
1 files changed, 15 insertions, 5 deletions
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
;;