32Kb, small memory footprint, single binary that run list of commands in parallel and waits for their termination

Overview

await build

32K, small memory footprint, single binary that run list of commands in parallel and waits for their termination

documentation

linux install

curl -L https://github.com/slavaGanzin/await/releases/download/0.91/await -o /usr/local/bin/await
chmod +x /usr/local/bin/await

macOS install

curl -L https://github.com/slavaGanzin/await/releases/download/0.9/await-macos -o /usr/local/bin/await
chmod +x /usr/local/bin/await

With await you can:

Action on specific file type changes

await 'stat **.c' --change --forever --exec 'gcc *.c -o await -lpthread'
# you can filter with:
`stat --format '%n %z' **; | grep -v node_modules`

Wait for FAANG to fail

await 'whois facebook.com' \
      'nslookup apple.com' \
      'dig +short amazon.com' \
      'sleep 1 | telnet netflix.com 443 2>/dev/null' \
      'http google.com' --fail

Notify yourself when your site down

await "curl 'https://whatnot.ai' &>/dev/null && echo UP || echo DOWN" \
      --forever --change --exec "ntfy send 'whatnot.ai \1'"

Use as concurrently

await "stylus --watch --compress --out /home/vganzin/work/whatnot/front /home/vganzin/work/whatnot/front/index.styl" \
      "pug /home/vganzin/work/whatnot/front/index.pug --out /home/vganzin/work/whatnot/front --watch --pretty 2>/dev/null" --forever --stdout --silent

Substitute while substituting

await 'echo -n 10' 'echo -n $RANDOM' 'expr \1 + \2' --exec 'echo \3' --forever --silent

Furiously wait for new iPhone in background process

await 'curl "https://www.apple.com/iphone/" -s | pup ".hero-eyebrow text{}" | grep -v 12' --interval 1000 --change --daemon --exec 'ntfy send "\1"'

Restart database and connect immediately after it become fully functional

sudo systemctl restart redis; await 'socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec 'redis-cli -s /tmp/redis.sock'

--help

await [arguments] commands

# runs list of commands and waits for their termination

OPTIONS:
  --help	#print this help
  --stdout -o	#print stdout of commands
  --silent -V	#do not print spinners and commands
  --fail -f	#waiting commands to fail
  --status -s	#expected status [default: 0]
  --any -a	#terminate if any of command return expected status
  --change -c	#waiting for stdout to change and ignore status codes
  --exec -e	#run some shell command on success;
  --interval -i	#milliseconds between one round of commands [default: 200]
  --forever -F	#do not exit ever
  --service -S	#create systemd user service with same parameters and activate it


NOTES:
# \1, \2 ... \n - will be subtituted with n-th command stdout
# you can use stdout substitution in --exec and in commands itself:
  await 'echo -n 10' 'echo -n $RANDOM' 'expr \1 + \2' --exec 'echo \3' --forever --silent


EXAMPLES:
# action on specific file type changes
 await 'stat **.c' --change --forever --exec 'gcc *.c -o await -lpthread'

# waiting google (or your internet connection) to fail
  await 'curl google.com' --fail

# waiting only google to fail (https://ec.haxx.se/usingcurl/usingcurl-returns)
  await 'curl google.com' --status 7

# waits for redis socket and then connects to
  await 'socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec 'redis-cli -s /tmp/redis.sock'

# lazy version
  await 'ls /tmp/redis.sock'; redis-cli -s /tmp/redis.sock

# daily checking if I am on french reviera. Just in case
  await 'curl https://ipapi.co/json 2>/dev/null | jq .city | grep Nice' --interval 86400

# Yet another server monitor
  await "curl 'https://whatnot.ai' &>/dev/null && echo 'UP' || echo 'DOWN'" --forever --change\
    --exec "ntfy send \'whatnot.ai \1\'"

# waiting for new iPhone in daemon mode
  await 'curl "https://www.apple.com/iphone/" -s | pup ".hero-eyebrow text{}" | grep -v 12'\
 --change --interval 86400 --daemon --exec "ntfy send \1"
Issues
  • How can I use it in script with bash functions?

    How can I use it in script with bash functions?

     ╰─λ cat test.sh 
    #!/bin/bash
    function func {
    echo 2
    }
    await 'echo 1' -e 'func'
    
     ╰─λ test.sh 
    sh: line 1: func: command not found
    ⣷ echo 1
    

    I've tried to pass function with different approaches, but no result. Is it possible to pass function (without using another scripts.sh files or writing entire commands in await) in my case?

    opened by Casul51 2
  • Availability via package managers

    Availability via package managers

    Hi Slava,

    I just stumbled over await and it looks great!

    It would be great if it would be available via platform independent package managers like Flathub or Snap. And for OS/X users a brew package would be nice.

    This way everybody could profit from automated updates. Thank you so much! :raised_hands:

    opened by alexanderadam 1
Plot airfield from a file containing the list of airfield of Germany and their position (latitude/longitude)

Plot aerodromes from a file containing the list of aerodromes of Germany and their position (latitude/longitude)

Nanfack Steve Ulrich 2 Feb 6, 2022
This project helps a person park their car in their garage in the same place every time.

garage-parking-sensor Description This project is developed to help a person park their car in their garage in the same place every time. Normally peo

Calvin Pereira 2 Sep 13, 2021
Cobalt Strike BOF to list Windows Pipes & return their Owners & DACL Permissions

xPipe Cobalt Strike BOF (x64) Cobalt Strike Beacon Object File (BOF) to list active Pipes & return their Owner & Discretionary Access Control List (DA

Bobby Cooke 59 Jul 6, 2022
A library to handle Apple Property List format in binary or XML

libplist A small portable C library to handle Apple Property List files in binary or XML format. Features The project provides an interface to read an

libimobiledevice 408 Jul 24, 2022
imGuIZMO.quat is a ImGui widget: like a trackball it provides a way to rotate models, lights, or objects with mouse, and graphically visualize their position in space, also around any single axis (Shift/Ctrl/Alt/Super)

imGuIZMO.quat v3.0 imGuIZMO.quat is a ImGui widget: like a trackball it provides a way to rotate models, lights, or objects with mouse, and graphicall

Michele Morrone 257 Jul 10, 2022
List & Read the processes memory using Windows APIs (PSAPI/ToolHelpAPI/WTSAPI)

Dumper List & Read the processes memory using Windows APIs PSAPI ToolHelp WTSAPI Usage The Dumper tool list the running procceses and provide the abil

ムハンマド 4 Aug 1, 2022
A configurable in-memory binary patcher.

?? Lyptus ?? A configurable in-memory binary patcher. ?? Usage Set up the Lyptus config with a list of patches to apply, and inject the Lyptus DLL int

null 13 Jul 4, 2022
S6-overlay-helpers - Small binary utilities, specific to s6-overlay

s6-overlay-helpers Small utilities specifically written for s6-overlay. s6-overlay-helpers centralizes all the additional C programs and libraries tha

null 8 May 3, 2022
Realtime Micro Kernel -- Event-driven Run-to-Completion RTOS with Active Objects, Timed Events, Memory Pools, and Message Queues

Realtime Micro Kernel Features Active Objects Message queues Variable sized, custom messages Periodic and single timed events Memory pools Supported P

null 2 Feb 25, 2022
A utility to run ELF files in memory.

execelf - A utility to execute ELF files in memory. execelf is small utility for running ELF files in memory, without touching the disk! Installation

null 5 Jul 22, 2022
Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

null 270 Jul 31, 2022
Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactively receive/edit/monitor data and send commands to an embedded system via the serial bus

See wiki for full documentation Serial Data Monitor Description Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactivel

monnoliv 4 Oct 29, 2021
A sketch that not only parses NMEA sentences, but also allows sending UBX commands and decrypt answers from the ublox module

RAK4631-ublox-Commander This is a tokenizer and parser for raw NMEA sentences. This is not intended (yet anyway) for production, but as an exercice in

Kongduino 2 May 29, 2022
Shell program written in C to implement various system calls, with support of executing commands, output redirection and signals.

Use ./shell command to start the shell. $<space>path/executable to run the executable(please specify the path without beginning it with "/"). Eg. type

Ayuj Panchal 1 Nov 15, 2021
The SPIR-V Tools project provides an API and commands for processing SPIR-V modules.

SPIR-V Tools Overview The SPIR-V Tools project provides an API and commands for processing SPIR-V modules. The project includes an assembler, binary m

The Khronos Group 769 Aug 2, 2022
Proof of concept userspace filesystem that executes filenames as shell commands and makes the result accessible though reading the file.

ExecFS Proof of concept userspace filesystem that executes filenames as shell commands and makes the result accessible though reading the file. $ ./ex

Camel Coder 27 Jul 20, 2022
hooking the execve syscall, to randomly sabotage typed bash commands.

Syscall hooks A small project of hooking the execve() syscall, to randomly sabotage typed bash commands. This project was tested on 5.11.0-38-generic.

ilevi 4 Aug 2, 2022
A simple PoC to demonstrate that is possible to write Non writable memory and execute Non executable memory on Windows

WindowsPermsPoC A simple PoC to demonstrate that is possible to write Non writable memory and execute Non executable memory on Windows You can build i

Lorenzo Maffia 55 Jul 21, 2022
Memory Process File System (MemProcFS) is an easy and convenient way of viewing physical memory as files in a virtual file system

The Memory Process File System (MemProcFS) is an easy and convenient way of viewing physical memory as files in a virtual file system.

Ulf Frisk 1.4k Aug 8, 2022