fix(statefile): Ensure valid statefile (#14937)
This commit is contained in:
parent
5aaea9986e
commit
8a1616223e
|
|
@ -57,6 +57,7 @@ test -d "$STATE_DIR" || {
|
||||||
STATE_FILE="$STATE_DIR/statefile"
|
STATE_FILE="$STATE_DIR/statefile"
|
||||||
test -f "$STATE_FILE" || {
|
test -f "$STATE_FILE" || {
|
||||||
touch "$STATE_FILE"
|
touch "$STATE_FILE"
|
||||||
|
echo {} > "$STATE_FILE"
|
||||||
chown root:telegraf "$STATE_FILE"
|
chown root:telegraf "$STATE_FILE"
|
||||||
chmod 660 "$STATE_FILE"
|
chmod 660 "$STATE_FILE"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ test -d "$STATE_DIR" || {
|
||||||
STATE_FILE="$STATE_DIR/statefile"
|
STATE_FILE="$STATE_DIR/statefile"
|
||||||
test -f "$STATE_FILE" || {
|
test -f "$STATE_FILE" || {
|
||||||
touch "$STATE_FILE"
|
touch "$STATE_FILE"
|
||||||
|
echo {} > "$STATE_FILE"
|
||||||
chown root:telegraf "$STATE_FILE"
|
chown root:telegraf "$STATE_FILE"
|
||||||
chmod 660 "$STATE_FILE"
|
chmod 660 "$STATE_FILE"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue