From 10c499f0c0a2d655a7cee26e4643ce2520053b05 Mon Sep 17 00:00:00 2001 From: Christian Loos Date: Fri, 17 Jan 2025 16:41:36 +0100 Subject: [PATCH] fix: fix Linux package scripts fixes #799 --- distributions/otelcol-contrib/postinstall.sh | 2 +- distributions/otelcol-contrib/preremove.sh | 8 +++++--- distributions/otelcol-otlp/postinstall.sh | 2 +- distributions/otelcol-otlp/preremove.sh | 8 +++++--- distributions/otelcol/postinstall.sh | 2 +- distributions/otelcol/preremove.sh | 8 +++++--- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/distributions/otelcol-contrib/postinstall.sh b/distributions/otelcol-contrib/postinstall.sh index 3ec790ba..d0e54dd8 100755 --- a/distributions/otelcol-contrib/postinstall.sh +++ b/distributions/otelcol-contrib/postinstall.sh @@ -17,6 +17,6 @@ if command -v systemctl >/dev/null 2>&1; then systemctl enable otelcol-contrib.service if [ -f /etc/otelcol-contrib/config.yaml ]; then - systemctl start otelcol-contrib.service + systemctl restart otelcol-contrib.service fi fi diff --git a/distributions/otelcol-contrib/preremove.sh b/distributions/otelcol-contrib/preremove.sh index 5739d608..adef459f 100755 --- a/distributions/otelcol-contrib/preremove.sh +++ b/distributions/otelcol-contrib/preremove.sh @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -if command -v systemctl >/dev/null 2>&1; then - systemctl stop otelcol-contrib.service - systemctl disable otelcol-contrib.service +if [ "$1" != "1" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl stop otelcol.service + systemctl disable otelcol.service + fi fi diff --git a/distributions/otelcol-otlp/postinstall.sh b/distributions/otelcol-otlp/postinstall.sh index 27402a41..764e653f 100755 --- a/distributions/otelcol-otlp/postinstall.sh +++ b/distributions/otelcol-otlp/postinstall.sh @@ -17,7 +17,7 @@ if command -v systemctl >/dev/null 2>&1; then systemctl enable otelcol-otlp.service if [ -f /etc/otelcol-otlp/config.yaml ]; then - systemctl start otelcol-otlp.service + systemctl restart otelcol-otlp.service else echo "Make sure to configure otelcol-otlp by creating /etc/otelcol-otlp/config.yaml" fi diff --git a/distributions/otelcol-otlp/preremove.sh b/distributions/otelcol-otlp/preremove.sh index 1323e27f..adef459f 100755 --- a/distributions/otelcol-otlp/preremove.sh +++ b/distributions/otelcol-otlp/preremove.sh @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -if command -v systemctl >/dev/null 2>&1; then - systemctl stop otelcol-otlp.service - systemctl disable otelcol-otlp.service +if [ "$1" != "1" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl stop otelcol.service + systemctl disable otelcol.service + fi fi diff --git a/distributions/otelcol/postinstall.sh b/distributions/otelcol/postinstall.sh index deb601cd..ffc9263e 100755 --- a/distributions/otelcol/postinstall.sh +++ b/distributions/otelcol/postinstall.sh @@ -17,6 +17,6 @@ if command -v systemctl >/dev/null 2>&1; then systemctl enable otelcol.service if [ -f /etc/otelcol/config.yaml ]; then - systemctl start otelcol.service + systemctl restart otelcol.service fi fi diff --git a/distributions/otelcol/preremove.sh b/distributions/otelcol/preremove.sh index 363e4de7..adef459f 100755 --- a/distributions/otelcol/preremove.sh +++ b/distributions/otelcol/preremove.sh @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -if command -v systemctl >/dev/null 2>&1; then - systemctl stop otelcol.service - systemctl disable otelcol.service +if [ "$1" != "1" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl stop otelcol.service + systemctl disable otelcol.service + fi fi