Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
set -eo pipefail
hostandport=$1
shift
curl -s "$hostandport" >/dev/null && \
echo "Already running on $hostandport" && \
exit 1 || exec "$@"
@peterbe

This comment has been minimized.

Show comment
Hide comment
@peterbe

peterbe Jun 11, 2018

To install, run:

curl -L -o ~/bin/unlessalready.sh https://gist.github.com/peterbe/0e676a4183167f54da5bf3d670acb7e3/raw/unlessalready.sh
chmod +x ~/bin/unlessalready.sh

Read the blog post for more info.

Owner

peterbe commented Jun 11, 2018

To install, run:

curl -L -o ~/bin/unlessalready.sh https://gist.github.com/peterbe/0e676a4183167f54da5bf3d670acb7e3/raw/unlessalready.sh
chmod +x ~/bin/unlessalready.sh

Read the blog post for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment