web_cmd: trying to fix flag file situation
This commit is contained in:
parent
9d036f9ad5
commit
af4015891b
14
web_cmd.sh
14
web_cmd.sh
|
@ -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}"
|
||||
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue