HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/lib/dpkg/info/opensearch.preinst
#!/bin/bash

# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

# deb opensearch preinst script

set -e

echo "Running OpenSearch Pre-Installation Script"

# Stop existing service
if command -v systemctl >/dev/null && systemctl is-active opensearch.service >/dev/null; then
    echo "Stop existing opensearch.service"
    systemctl --no-reload stop opensearch.service
fi
if command -v systemctl >/dev/null && systemctl is-active opensearch-performance-analyzer.service >/dev/null; then
    echo "Stop existing opensearch-performance-analyzer.service"
    systemctl --no-reload stop opensearch-performance-analyzer.service
fi

# Create user and group if they do not already exist.
getent group opensearch > /dev/null 2>&1 || groupadd -r opensearch
getent passwd opensearch > /dev/null 2>&1 || \
    useradd -r -g opensearch -M -s /sbin/nologin \
        -c "opensearch user/group" opensearch
exit 0