Skip to content

Latest commit

 

History

History

utils

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Util Scripts

This is a collection of helper scripts that are used in the main scripts. They are not guaranteed to work as standalone scripts but can still be called directly from the terminal if needed.

Usage

NOTE: Call scripts from the root directory. If called from any other subdirectory, the relative paths used by scripts will not work.

Runs a periodic, finite loop to check if a server is live at the given url.

Args:

  • --url=server-url:port (REQUIRED)
  • --interval=5 (OPTIONAL. Wait time between requests in seconds. Defaults to 5)
  • --max_retries=20 (OPTIONAL. Maximum number of requests to send. Defaults to 20)
sh ./utils/check-connection.sh --url=localhost:8080 --interval=5 --max_retries=20

Importable script that can be added to the top of other scripts to parse command line arguments, like so:

#!/bin/sh

# Get named arguments
. utils/parse-args.sh "$@"
...

Command line arguments can then be accessed by their name. For example, if the argument is passed as --arg=value, it can be accessed in your script by referencing it: echo "arg value: $arg".