Просмотр исходного кода

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.
Christoph Schug 2 лет назад
Родитель
Сommit
65b172436f
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      ansible/maintenance/maint-diskspace

+ 1 - 1
ansible/maintenance/maint-diskspace

@@ -6,7 +6,7 @@
       command: df -h
       command: df -h
       register: disk_usage
       register: disk_usage
     - name: check disk space available
     - name: check disk space available
-      shell: df -h / | awk 'NR==2 {print $5}'
+      shell: df -Ph / | awk 'NR==2 {print $5}'
       register: disk_usage
       register: disk_usage
     # - name: send discord message when disk space is over 80%
     # - name: send discord message when disk space is over 80%
     #   uri:
     #   uri: