Ticket #43644: Xymon_MacPorts_ticket.txt

File Xymon_MacPorts_ticket.txt, 2.1 KB (added by MacPorts.ORG@…, 10 years ago)

Script "df" sub-section output and proposed partial fix

Line 
1On a Mac mini with the following filesystems:
2
3/Volumes/MacintoshHD
4/Volumes/MacintoshHD 1
5/Volumes/BOOTCAMP
6/Volumes/BOOTCAMP 1
7/Volumes/Time Machine Backups
8
9running the "[df]" code in "xymonclient-darwin.sh" starting with
10
11FILESYSTEMS=`mount | grep -v nobrowse | awk '{print $3}'`
12echo "[df]"
13set $FILESYSTEMS
14(df -H $1; shift
15 while test $# -gt 0
16 do
17   df -H $1 | tail -1
18   shift
19 done) | column -t -s " " | sed -e 's!Mounted *on!Mounted on!'
20
21produces this output:
22
23++ mount
24++ grep -v nobrowse
25++ awk '{print $3}'
26+ FILESYSTEMS='/
27/Volumes/Time
28/Volumes/BOOTCAMP
29/Volumes/Macintosh
30/Volumes/BOOTCAMP'
31+ echo '[df]'
32[df]
33+ set / /Volumes/Time /Volumes/BOOTCAMP /Volumes/Macintosh /Volumes/BOOTCAMP
34+ df -H /
35+ column -t -s ' '
36+ sed -e 's!Mounted *on!Mounted on!'
37+ shift
38+ test 4 -gt 0
39+ df -H /Volumes/Time
40+ tail -1
41df: /Volumes/Time: No such file or directory
42+ shift
43+ test 3 -gt 0
44+ df -H /Volumes/BOOTCAMP
45+ tail -1
46+ shift
47+ test 2 -gt 0
48+ df -H /Volumes/Macintosh
49+ tail -1
50df: /Volumes/Macintosh: No such file or directory
51+ shift
52+ test 1 -gt 0
53+ df -H /Volumes/BOOTCAMP
54+ tail -1
55+ shift
56+ test 0 -gt 0
57Filesystem    Size  Used  Avail  Capacity  iused      ifree     %iused  Mounted on
58/dev/disk0s2  971G  730G  241G   76%       178211272  58934722  75%     /
59/dev/disk0s4  28G   24G   4.3G   85%       101211     4246369   2%      /Volumes/BOOTCAMP
60/dev/disk0s4  28G   24G   4.3G   85%       101211     4246369   2%      /Volumes/BOOTCAMP
61
62which is obviously quite wrong.
63
64My first proposal is to replace the awk code with
65
66FILESYSTEMS=`mount | grep -v nobrowse | sed -e 's/^.* on \(.*\) [(].*$/\1/g'`
67
68This results in
69
70++ mount
71++ grep -v nobrowse
72++ sed -e 's/^.* on \(.*\) [(].*$/\1/g'
73+ FILESYSTEMS='/
74/Volumes/Time Machine Backups
75/Volumes/BOOTCAMP
76/Volumes/Macintosh HD
77/Volumes/BOOTCAMP 1'
78+ echo '[df]'
79[df]
80+ set / /Volumes/Time Machine Backups /Volumes/BOOTCAMP /Volumes/Macintosh HD /Volumes/BOOTCAMP 1
81
82which at least has the correct volume names/strings in it.
83
84Then I would replace this code with something that iterates over each line
85of output from 'df', instead of setting FILESYSTEMS all at once from the
86entire output.
87