summaryrefslogtreecommitdiffstats
path: root/configuration/debian/tedge_mapper/prerm
blob: cf4bf9bab362a009acb564daad5d7658948dc579 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

set -e

print_hint() {
    echo "$1 is running. Stop $1 before installation, use: systemctl stop $1"
    echo "If you want to start $1 after installation, use: systemctl restart $1"
    echo "Make sure that other mappers are not running: systemctl is-active [mapper_name]"
    echo "Known mappers are: tedge-mapper-c8y, tedge-mapper-collectd, tedge-mapper-az".
}

# Reenable the services only if systemctl is available
if command -v systemctl >/dev/null; then
    if systemctl is-active --quiet tedge-mapper-c8y; then
        print_hint "tedge-mapper-c8y"
        exit 1
    fi

    if systemctl is-active --quiet tedge-mapper-collectd; then
        print_hint "tedge-mapper-collectd"
        exit 1
    fi

    if systemctl is-active --quiet tedge-mapper-az; then
        print_hint "tedge-mapper-az"
        exit 1
    fi
fi

#DEBHELPER#