Skip to content

Commit

Permalink
Fix sid check
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Sep 14, 2024
1 parent 7c20180 commit dd5dad5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/include/sid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# and they are generated once and then stored into lib/var/.server_id
# they are used to kill the process and make sure not to kill the wrong server

SID_FILE="$SCRIPT_ROOT/lib/var/.server_id"
RELATIVE_SID_FILE="lib/var/.server_id"
SID_FILE="$SCRIPT_ROOT/$RELATIVE_SID_FILE"
OLD_SID_FILE="$SCRIPT_ROOT/lib/.server_id" # backwards compability

function generate_uuid() {
Expand Down
4 changes: 3 additions & 1 deletion lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ function check_duplicated_uuid() {
# skip this instance
exit 0
fi
comp_uuid="$(cat "$SID_FILE")"
[[ -f "$RELATIVE_SID_FILE" ]] || exit 0

comp_uuid="$(cat "$RELATIVE_SID_FILE")"
if [ "$comp_uuid" == "$SERVER_UUID" ]
then
wrn "Warning: same server uuid used in $(tput bold)$d$(tput sgr0)"
Expand Down

0 comments on commit dd5dad5

Please sign in to comment.