package-pipelines-miscellan.../prometheus-ipmi-exporter/debian.postinst

24 lines
641 B
Text
Raw Normal View History

2023-12-05 23:40:22 +01:00
#!/bin/bash
set -e
if [[ "$1" == "configure" ]]; then
if ! getent group prometheus >/dev/null; then
groupadd --system prometheus
fi
if ! getent passwd prometheus >/dev/null; then
useradd --system --gid prometheus --home-dir /var/lib/prometheus --shell /usr/sbin/nologin prometheus
fi
chown root:prometheus /etc/prometheus/ipmi-exporter /etc/prometheus/ipmi-exporter/config.yaml
chmod g+rx /etc/prometheus/ipmi-exporter
chmod g+r /etc/prometheus/ipmi-exporter
deb-systemd-helper enable prometheus-ipmi-exporter.service
deb-systemd-invoke restart prometheus-ipmi-exporter.service
fi