2 # Copyright (C) 2022 Ian Kelling
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 source /a
/bin
/errhandle
/err
17 [[ $EUID == 0 ]] ||
exec sudo
-E "${BASH_SOURCE[0]}" "$@"
21 mkdir
-p /var
/lib
/prometheus
/node-exporter
23 f
=/var
/local
/sysd-prom-fail
/${ser_name}-result-fail.prom
26 if [[ ! -s /var
/lib
/prometheus
/node-exporter
/${ser_name}-result-fail.premerge
]]; then
27 SERVICE_RESULT
=success
/usr
/local
/bin
/sysd-prom-fail
$ser_name
34 ExecStopPost=+/usr/local/bin/sysd-prom-fail $ser_name
37 dir
=/etc
/systemd
/system
/$ser_name.service.d
39 out
=$
(rsync
-cipgo --chmod=644 --chown=root
:root
$tmp $dir/sysd-prom-fail.conf
)
41 echo $0: systemctl daemon-reload
42 systemctl daemon-reload
43 if systemctl is-active
$ser_name &>/dev
/null
; then
44 echo $0: systemctl restart
$ser_name
45 systemctl restart
$ser_name ||
: