Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions scripts/tools/ops/daemon-confignode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ if [ ! -d "$SYSTEMD_DIR" ]; then
exit 1 # Exit with an error status
fi

if [ -z "$JAVA_HOME" ]; then
echo "JAVA_HOME is not set. Please set the JAVA_HOME environment variable."
if ! java --version >/dev/null 2>&1; then
echo "java command is not available. Please install Java or ensure it is in PATH."
exit 1
fi

FILE_NAME=$SYSTEMD_DIR/iotdb-confignode.service

if [ -z "$JAVA_HOME" ]; then
cat > "$FILE_NAME" <<EOF
[Unit]
Description=iotdb-confignode
Expand All @@ -46,6 +47,34 @@ Type=simple
User=root
Group=root
Environment=JAVA_HOME=$JAVA_HOME
Environment=PATH=$JAVA_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=$IOTDB_SBIN_HOME/start-confignode.sh
ExecStop=$IOTDB_SBIN_HOME/stop-confignode.sh
Restart=on-failure
SuccessExitStatus=143
RestartSec=5
StartLimitInterval=600s
StartLimitBurst=3
RestartPreventExitStatus=SIGKILL

[Install]
WantedBy=multi-user.target
EOF
else
cat > "$FILE_NAME" <<EOF
[Unit]
Description=iotdb-confignode
Documentation=https://iotdb.apache.org/
After=network.target

[Service]
StandardOutput=null
StandardError=null
LimitNOFILE=65536
Type=simple
User=root
Group=root
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=$IOTDB_SBIN_HOME/start-confignode.sh
ExecStop=$IOTDB_SBIN_HOME/stop-confignode.sh
Restart=on-failure
Expand All @@ -58,6 +87,7 @@ RestartPreventExitStatus=SIGKILL
[Install]
WantedBy=multi-user.target
EOF
fi

echo "Daemon service of IoTDB ConfigNode has been successfully registered."

Expand Down
34 changes: 32 additions & 2 deletions scripts/tools/ops/daemon-datanode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ if [ ! -d "$SYSTEMD_DIR" ]; then
exit 1 # Exit with an error status
fi

if [ -z "$JAVA_HOME" ]; then
echo "JAVA_HOME is not set. Please set the JAVA_HOME environment variable."
if ! java --version >/dev/null 2>&1; then
echo "java command is not available. Please install Java or ensure it is in PATH."
exit 1
fi

FILE_NAME=$SYSTEMD_DIR/iotdb-datanode.service

if [ -z "$JAVA_HOME" ]; then
cat > "$FILE_NAME" <<EOF
[Unit]
Description=iotdb-datanode
Expand All @@ -46,6 +47,34 @@ Type=simple
User=root
Group=root
Environment=JAVA_HOME=$JAVA_HOME
Environment=PATH=$JAVA_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=$IOTDB_SBIN_HOME/start-datanode.sh
ExecStop=$IOTDB_SBIN_HOME/stop-datanode.sh
Restart=on-failure
SuccessExitStatus=143
RestartSec=5
StartLimitInterval=600s
StartLimitBurst=3
RestartPreventExitStatus=SIGKILL

[Install]
WantedBy=multi-user.target
EOF
else
cat > "$FILE_NAME" <<EOF
[Unit]
Description=iotdb-datanode
Documentation=https://iotdb.apache.org/
After=network.target

[Service]
StandardOutput=null
StandardError=null
LimitNOFILE=65536
Type=simple
User=root
Group=root
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=$IOTDB_SBIN_HOME/start-datanode.sh
ExecStop=$IOTDB_SBIN_HOME/stop-datanode.sh
Restart=on-failure
Expand All @@ -58,6 +87,7 @@ RestartPreventExitStatus=SIGKILL
[Install]
WantedBy=multi-user.target
EOF
fi

echo "Daemon service of IoTDB DataNode has been successfully registered."

Expand Down
Loading