diff --git a/iotdb-core/ainode/ainode.xml b/iotdb-core/ainode/ainode.xml index 6de635c13385..b47cbeb4a796 100644 --- a/iotdb-core/ainode/ainode.xml +++ b/iotdb-core/ainode/ainode.xml @@ -69,5 +69,14 @@ 0755 + + ${project.basedir}/../../scripts/tools/ops + tools/ops + + *ainode.* + **/*ainode.* + + 0755 + diff --git a/scripts/tools/ops/daemon-ainode.sh b/scripts/tools/ops/daemon-ainode.sh new file mode 100644 index 000000000000..fb5e4bd88a8a --- /dev/null +++ b/scripts/tools/ops/daemon-ainode.sh @@ -0,0 +1,73 @@ +#!/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" </dev/null 2>&1 & + systemctl start iotdb-ainode + echo "Executed successfully." +fi +echo +echo "Do you want to execute 'systemctl enable iotdb-ainode' to start at boot? y/n (default y)" +read -r ADD_STARTUP +if [[ -z "$ADD_STARTUP" || "$ADD_STARTUP" =~ ^[Yy]$ ]]; then + systemctl enable iotdb-ainode >/dev/null 2>&1 + echo "Executed successfully." +fi \ No newline at end of file diff --git a/scripts/tools/ops/daemon-confignode.sh b/scripts/tools/ops/daemon-confignode.sh index 8e1d0d9cd94b..9bdb23377e6a 100644 --- a/scripts/tools/ops/daemon-confignode.sh +++ b/scripts/tools/ops/daemon-confignode.sh @@ -47,6 +47,7 @@ User=root Group=root Environment=JAVA_HOME=$JAVA_HOME ExecStart=$IOTDB_SBIN_HOME/start-confignode.sh +ExecStop=$IOTDB_SBIN_HOME/stop-confignode.sh Restart=on-failure SuccessExitStatus=143 RestartSec=5 @@ -65,7 +66,7 @@ echo echo "Do you want to execute 'systemctl start iotdb-confignode'? y/n (default y)" read -r START_SERVICE if [[ -z "$START_SERVICE" || "$START_SERVICE" =~ ^[Yy]$ ]]; then - "${IOTDB_SBIN_HOME}"/sbin/stop-confignode.sh >/dev/null 2>&1 & + "${IOTDB_SBIN_HOME}"/stop-confignode.sh >/dev/null 2>&1 & systemctl start iotdb-confignode echo "Executed successfully." fi diff --git a/scripts/tools/ops/daemon-datanode.sh b/scripts/tools/ops/daemon-datanode.sh index 10dc5b4ef094..5c5963c2bf5a 100644 --- a/scripts/tools/ops/daemon-datanode.sh +++ b/scripts/tools/ops/daemon-datanode.sh @@ -47,6 +47,7 @@ User=root Group=root Environment=JAVA_HOME=$JAVA_HOME ExecStart=$IOTDB_SBIN_HOME/start-datanode.sh +ExecStop=$IOTDB_SBIN_HOME/stop-datanode.sh Restart=on-failure SuccessExitStatus=143 RestartSec=5 @@ -65,7 +66,7 @@ echo echo "Do you want to execute 'systemctl start iotdb-datanode'? y/n (default y)" read -r START_SERVICE if [[ -z "$START_SERVICE" || "$START_SERVICE" =~ ^[Yy]$ ]]; then - "${IOTDB_SBIN_HOME}"/sbin/stop-datanode.sh >/dev/null 2>&1 & + "${IOTDB_SBIN_HOME}"/stop-datanode.sh >/dev/null 2>&1 & systemctl start iotdb-datanode echo "Executed successfully." fi