Skip to main content

Simple shell script which runs lists of shell commands in parallel

Project description

Shell multiprocess

A script which runs shell commands in parallel. Commands are being fed from a file.

Install:

$: python3 -m pip install shell-multiprocess

Run:

$: multiprocess -h
usage: multiprocess [-h] [-s] [-l] filename processes

Script which reads a file with shell commands and runs them in parallel
processes.

positional arguments:
  filename           Filename with commands
  processes          Amount of parallel processes

optional arguments:
  -h, --help         show this help message and exit
  -s, --soft-kill    Sends SIGINT signal to subprocesses instead of SIGKILL
                     during cleanup after CTRL-C
  -l, --log-to-file  Send multiprocess sumup to file with name
                     'multiprocess_{pid}.log'. Log is being update each time
                     an event occurs and can be viewed to monitor progress.

Create a command file:

$: cat > cmd.list
sleep 1 && sleep2 && echo finished_1_2
sleep 3 && echo finished_3  # finish with CTRL+D

Run it in parallel - both lines should finish at the same time:

multiprocess cmd.list 2
finished_3
finished_1_2
status      |        start        |         end         |       elapsed       | command
----------- | ------------------- | ------------------- | ------------------- | -------
done        | 2021-08-17 22:28:12 | 2021-08-17 22:28:15 |   0:00:03.003935    | sleep 1 && sleep 2 && echo finished_1_2
done        | 2021-08-17 22:28:12 | 2021-08-17 22:28:15 |   0:00:03.000876    | sleep 3 && echo finished_3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shell_multiprocess-1.0.2.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shell_multiprocess-1.0.2-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file shell_multiprocess-1.0.2.tar.gz.

File metadata

  • Download URL: shell_multiprocess-1.0.2.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.6.9

File hashes

Hashes for shell_multiprocess-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b10461f99868f858f1385a30279df3d1fbe697c2039eff9da3306009064187c6
MD5 1b81b64bbd6ac79c717637d21fabf83c
BLAKE2b-256 b35ef667bd1febf2f7bd9d531a707acfbc295763ffa7bfffc5d7fa51b4cd8c4b

See more details on using hashes here.

File details

Details for the file shell_multiprocess-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: shell_multiprocess-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.6.9

File hashes

Hashes for shell_multiprocess-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8451a72489409b3c63684b108a4be817f7dd043318e36e040a54fe6ebeb272ae
MD5 be32a9a60e218aa7ea20ea10928aaaff
BLAKE2b-256 3e559bdac0da33adab216800dede2f445c168327bf92f12055c8842eea05b15c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page