- avoid 2nd copy of agent

This commit is contained in:
Dmytro Bogovych 2023-09-08 15:25:05 +01:00
parent ace93a7c51
commit 59d38975e3
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,12 @@
# Oneliner to find script's directory. Please note - last path component should NOT be symlink. # Oneliner to find script's directory. Please note - last path component should NOT be symlink.
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
for pid in $(pidof -x run_agent.sh); do
if [ $pid != $$ ]; then
echo "[$(date)] : run_agent.sh : Process is already running with PID $pid. Exiting."
exit 1
fi
done
while : while :
do do