-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent start from running if pid file exists #27
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe updates in the scripts Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the PID file directory exists before checking for the file.
If the .draft/pids
directory does not exist, the script will fail when attempting to create the PID file. Consider adding a check to create the directory if it does not exist.
pid_file=".draft/pids/local_dev.pid"
# Ensure the PID file directory exists
mkdir -p "$(dirname "$pid_file")"
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the PID file is removed upon process termination.
To prevent stale PID files from causing issues, consider adding a trap to remove the PID file when the process terminates.
trap "rm -f '$pid_file'" EXIT
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the PID file directory exists before checking for the file.
If the .draft/pids
directory does not exist, the script will fail when attempting to create the PID file. Consider adding a check to create the directory if it does not exist.
pid_file=".draft/pids/helper_sidecar.pid"
# Ensure the PID file directory exists
mkdir -p "$(dirname "$pid_file")"
# Check if pid file exists
if [ -f "$pid_file" ]; then
echo "Error: $pid_file already exists."
exit 1
fi
@@ -8,4 +15,4 @@ | |||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the PID file is removed upon process termination.
To prevent stale PID files from causing issues, consider adding a trap to remove the PID file when the process terminates.
trap "rm -f '$pid_file'" EXIT
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
small change so that start doesn't get run twice
Summary by CodeRabbit