aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-08-21 18:06:52 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-08-21 18:06:52 +0200
commit54652db0079945faf378f949fb45914eb629eb8d (patch)
treea353c96376d80fadd85164b4ad2d8b463669aeeb
parent5808757a6cd091ede4a3633c0f175d2a412b0c23 (diff)
Minor changes
-rw-r--r--README.md2
-rwxr-xr-xpool.sh10
2 files changed, 7 insertions, 5 deletions
diff --git a/README.md b/README.md
index 3f921c2..7ccb01f 100644
--- a/README.md
+++ b/README.md
@@ -13,4 +13,4 @@
- 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>`
-**Finale quote:** No checks are performed on the pool.sh arguments. Be sure to use the right ones.
+**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 dbaec3c..aa96cca 100755
--- a/pool.sh
+++ b/pool.sh
@@ -58,7 +58,7 @@ create() {
}
remove() {
- refresh
+ refresh # Refresh process status and load status
[ $nproc -gt 0 ] && abort "Processes are still running in the pool!"
rm -rf "$pool"
}
@@ -80,11 +80,13 @@ refresh() {
run() {
refresh
+ # Wait for room in the pool
while [ $nproc -ge $maxproc ]
do
sleep $REFRESH_EVERY
refresh
done
+ # Create new process
nproc=$(( nproc + 1 ))
procid=$(( lastprocid + 1 ))
lastprocid=$procid
@@ -92,9 +94,9 @@ run() {
$PROC_CMD > "$pool/out_$procid" &
procpid=$!
[ -z "$procs" ] && procs="$procpid" || procs="$procs $procpid"
- write_status
- write_process
- echo $procid
+ write_status # Update status
+ write_process # Create process properties
+ echo $procid # Return process id
}
cat_output() {