From 8ad4f8fed6197bed25b14753355303c29fa14cdf Mon Sep 17 00:00:00 2001 From: pedro Date: Fri, 15 Mar 2024 09:14:46 +0100 Subject: [PATCH] add web_cmd --- web_cmd.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 web_cmd.sh diff --git a/web_cmd.sh b/web_cmd.sh new file mode 100644 index 0000000..1dfcfdb --- /dev/null +++ b/web_cmd.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e +set -u +# DEBUG +#set -x + +main() { + cmd="${1}" + + cd "$(dirname "${0}")" + flock=".web_command_lock" + if [ -f "${flock}" ]; then + content="$(cat "${flock}")" + echo "web command already requested: ${content}" + else + touch + deployment="${deployment:-prod}" + echo "requested ${cmd}" + ${cmd} & + fi + rm "${flock}" + +} + +main "${@}"