Copilot commented on code in PR #17138: URL: https://github.com/apache/iotdb/pull/17138#discussion_r2752719840
########## scripts/tools/ops/daemon-ainode.sh: ########## @@ -0,0 +1,72 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +IOTDB_AINODE_SBIN_HOME="$(cd "`dirname "$0"`"/../../sbin; pwd)" +SYSTEMD_DIR="/etc/systemd/system" + +if [ ! -d "$SYSTEMD_DIR" ]; then + echo "Current system can't support systemd" + exit 1 # Exit with an error status +fi + +FILE_NAME=$SYSTEMD_DIR/iotdb-ainode.service + +cat > "$FILE_NAME" <<EOF +[Unit] +Description=iotdb-ainode +Documentation=https://iotdb.apache.org/ +After=network.target + +[Service] +StandardOutput=null +StandardError=null +LimitNOFILE=65536 +Type=simple +User=root +Group=root +ExecStart=$IOTDB_AINODE_SBIN_HOME/start-ainode.sh +Restart=on-failure +SuccessExitStatus=143 +RestartSec=5 +StartLimitInterval=600s +StartLimitBurst=3 +RestartPreventExitStatus=SIGKILL + +[Install] +WantedBy=multi-user.target +EOF + +echo "Daemon service of IoTDB AINode has been successfully registered." + +systemctl daemon-reload +echo +echo "Do you want to execute 'systemctl start iotdb-ainode'? y/n (default y)" +read -r START_SERVICE +if [[ -z "$START_SERVICE" || "$START_SERVICE" =~ ^[Yy]$ ]]; then + "${IOTDB_AINODE_SBIN_HOME}"/sbin/stop-ainode.sh >/dev/null 2>&1 & Review Comment: The path to stop-ainode.sh is incorrect. The variable IOTDB_AINODE_SBIN_HOME already points to the sbin directory (see line 20), so the path should be "${IOTDB_AINODE_SBIN_HOME}/stop-ainode.sh" instead of "${IOTDB_AINODE_SBIN_HOME}/sbin/stop-ainode.sh". The extra "/sbin" segment would result in a path like "../../sbin/sbin/stop-ainode.sh" which doesn't exist. This pattern is correctly followed in daemon-confignode.sh:68 and daemon-datanode.sh:68 where "${IOTDB_SBIN_HOME}/sbin/stop-confignode.sh" and "${IOTDB_SBIN_HOME}/sbin/stop-datanode.sh" are used respectively. ```suggestion "${IOTDB_AINODE_SBIN_HOME}"/stop-ainode.sh >/dev/null 2>&1 & ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
