fix(statefile): Ensure valid statefile (#14937)

This commit is contained in:
Joshua Powers 2024-03-05 09:53:12 -07:00 committed by GitHub
parent 5aaea9986e
commit 8a1616223e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View File

@ -57,6 +57,7 @@ test -d "$STATE_DIR" || {
STATE_FILE="$STATE_DIR/statefile"
test -f "$STATE_FILE" || {
touch "$STATE_FILE"
echo {} > "$STATE_FILE"
chown root:telegraf "$STATE_FILE"
chmod 660 "$STATE_FILE"
}

View File

@ -36,6 +36,7 @@ test -d "$STATE_DIR" || {
STATE_FILE="$STATE_DIR/statefile"
test -f "$STATE_FILE" || {
touch "$STATE_FILE"
echo {} > "$STATE_FILE"
chown root:telegraf "$STATE_FILE"
chmod 660 "$STATE_FILE"
}