From 65b172436f8b94c5fcb2404ca84bf859032fcd73 Mon Sep 17 00:00:00 2001 From: Christoph Schug Date: Fri, 23 Feb 2024 00:05:50 +0100 Subject: [PATCH] fix: enforce output of df to be single-lined per file system This change forces `df(1)` to output each file system on a single line by setting the `-P` flag (POSIX output format). Without it, some versions of `df(1)` split the output into multiple lines if the length of some fields like "Filesystem" exceeds a certain limit. As a consequence, the `awk(1)` expression might fail to catch the correct fields. Please note that this fixes a file which is also wrongly named, which is being addressed in PR #151. Relates to PR #151. Fixes issue #137. --- ansible/maintenance/maint-diskspace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/maintenance/maint-diskspace b/ansible/maintenance/maint-diskspace index 7737528..81b9a58 100644 --- a/ansible/maintenance/maint-diskspace +++ b/ansible/maintenance/maint-diskspace @@ -6,7 +6,7 @@ command: df -h register: disk_usage - name: check disk space available - shell: df -h / | awk 'NR==2 {print $5}' + shell: df -Ph / | awk 'NR==2 {print $5}' register: disk_usage # - name: send discord message when disk space is over 80% # uri: