This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
idhub-docker/web_cmd.sh

27 lines
537 B
Bash
Raw Normal View History

2024-03-15 08:14:46 +00:00
#!/bin/sh
set -e
set -u
# DEBUG
2024-03-15 08:23:19 +00:00
set -x
2024-03-15 08:14:46 +00:00
main() {
cmd="${1}"
cd "$(dirname "${0}")"
flagf=".web_command_lock"
if [ -f "${flagf}" ]; then
content="$(cat "${flagf}")"
printf "web command already requested:\n %s\n" "${content}"
2024-03-15 08:14:46 +00:00
else
printf "%s" "${cmd}" > "${flagf}"
2024-03-15 08:14:46 +00:00
deployment="${deployment:-prod}"
printf "requested command:\n %s\n" "${cmd}"
2024-03-15 08:14:46 +00:00
${cmd} &
fi
rm "${flagf}"
2024-03-15 08:14:46 +00:00
}
main "${@}"