web_cmd: trying to fix flag file situation

This commit is contained in:
pedro 2024-03-15 09:33:23 +01:00
parent 9d036f9ad5
commit af4015891b

View file

@ -9,17 +9,17 @@ main() {
cmd="${1}" cmd="${1}"
cd "$(dirname "${0}")" cd "$(dirname "${0}")"
flock=".web_command_lock" flagf=".web_command_lock"
if [ -f "${flock}" ]; then if [ -f "${flagf}" ]; then
content="$(cat "${flock}")" content="$(cat "${flagf}")"
echo "web command already requested: ${content}" printf "web command already requested:\n %s\n" "${content}"
else else
touch "${flock}" printf "%s" "${cmd}" > "${flagf}"
deployment="${deployment:-prod}" deployment="${deployment:-prod}"
echo "requested ${cmd}" printf "requested command:\n %s\n" "${cmd}"
${cmd} & ${cmd} &
fi fi
rm "${flock}" rm "${flagf}"
} }