Crates.io | async-cmd |
lib.rs | async-cmd |
version | 0.1.1 |
source | src |
created_at | 2019-06-27 13:54:39.049459 |
updated_at | 2019-06-27 14:06:29.306289 |
description | A tool to run shell commands in parallel. |
homepage | |
repository | https://github.com/ctbur/async/ |
max_upload_size | |
id | 143991 |
size | 57,644 |
async
is a tool to run shell commands in parallel and is designed to be able to quickly parallelize shell scripts with minimal changes.
It was inspired by GNU Parallel, with the main difference being that async
retains state between commands by running a server in the background.
All information about the command line interface is available using async --help
. Below is an example on how to use async
to parallelize commands:
#!/bin/bash
S="/tmp/example_socket"
async -s="$S" server --start
for i in {1..20}; do
# prints command output to stdout
async -s="$S" cmd -- bash -c "sleep 1 && echo test $i"
done
# wait until all commands are finished
async -s="$S" wait
# configure the server to run four commands in parallel
async -s="$S" server -j4
mkdir "/tmp/ex_dir"
for i in {21..40}; do
# redirects command output to /tmp/ex_dir/file*
async -s="$S" cmd -o "/tmp/ex_dir/file$i" -- bash -c "sleep 1 && echo test $i"
done
async -s="$S" wait
# stops server
async -s="$S" server --stop
If you encounter an unexpected error or crash, please turn on logging by setting the environment variable RUST_LOG=debug
and open an issue on the Github repository.
async
can be installed using cargo with cargo install async-cmd
or from the AUR.