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
1 changed files with 7 additions and 7 deletions

View File

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