Skip to content

Commit

Permalink
prevent start from running if pid file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
eriktaubeneck committed May 16, 2024
1 parent af2247f commit aec7d9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion etc/start_helper_sidecar.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash

pid_file=".draft/pids/helper_sidecar.pid"
# Check if pid file exists
if [ -f "$pid_file" ]; then
echo "Error: $pid_file already exists."
exit 1
fi

config_path=$1
root_path=$2
root_domain=$3
Expand All @@ -8,4 +15,4 @@ helper_port=$5
sidecar_port=$6
identity=$7

nohup draft run-helper-sidecar --config_path "$config_path" --root_path "$root_path" --root_domain "$root_domain" --sidecar_domain "$sidecar_domain" --helper_port "$helper_port" --sidecar_port "$sidecar_port" --identity "$identity" > .draft/logs/helper_sidecar.log 2>&1 & echo $! > .draft/pids/helper_sidecar.pid
nohup draft run-helper-sidecar --config_path "$config_path" --root_path "$root_path" --root_domain "$root_domain" --sidecar_domain "$sidecar_domain" --helper_port "$helper_port" --sidecar_port "$sidecar_port" --identity "$identity" > .draft/logs/helper_sidecar.log 2>&1 & echo $! > $pid_file
9 changes: 8 additions & 1 deletion etc/start_local_dev.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/bin/bash

pid_file=".draft/pids/local_dev.pid"
# Check if pid file exists
if [ -f "$pid_file" ]; then
echo "Error: $pid_file already exists."
exit 1
fi

config_path=$1
root_path=$2
helper_start_port=$3
sidecar_start_port=$4

nohup draft run-local-dev --config_path "$config_path" --root_path "$root_path" --helper_start_port "$helper_start_port" --sidecar_start_port "$sidecar_start_port" > .draft/logs/local_dev.log 2>&1 & echo $! > .draft/pids/local_dev.pid
nohup draft run-local-dev --config_path "$config_path" --root_path "$root_path" --helper_start_port "$helper_start_port" --sidecar_start_port "$sidecar_start_port" > .draft/logs/local_dev.log 2>&1 & echo $! > $pid_file

0 comments on commit aec7d9a

Please sign in to comment.