title: df shows double the actual size on FreeBSD when run via cron
body: <p>I have written a bash script that collects data from a server
  and sends it to a log file that is being monitored by a
  splunkforwarder. The server runs FreeBSD and has a ZPool that
  is shared via Samba. So of course one of the things I'd like
  splunk to keep an eye on is how much space is used on said share.</p>
  
  <p>To keep things readable, I have extracted the lines from my script that achieve this:</p>
  
  <pre><code>#!/usr/bin/env bash
  while read disk used avail ; do
          # In reality I pass these values to a function
          # that adds some formatting, but let's keep it
          # simple for the moment
          echo $disk " " $used " " $avail
  done &lt; &lt;(df | awk '/datapool\// {print $1, $3, $4}')
  </code></pre>
  
  <p>When I run these lines from the command line I get the correct
  numbers (I have compared the output with <code>zfs list</code>).
  But when I run this script via cron, the numbers I get are all
  doubled.</p>
  
  <p>Let's look at the exact output on my machine:</p>
  
  <pre><code># Manually
  datapool/myshare   4842023944   24758292883
  
  # Via cron
  datapool/myshare   9684047889   49516585766
  </code></pre>
  
  <p>This only happens on FreeBSD. I have another ZFS storage server
  that runs on Debian and when I run the exact same script there,
  I get correct numbers all of the time.</p>
  
  <p>I have tried running the cron job as different users
  (including root), but it's always the same result. I have also
  set the PATH environment variable to the same value that I have
  when I run this script manually (instead of the shortened
  version that cron usually uses).</p>
  
  <p>I have absolutely no clue regarding the cause of this problem
  and I really don't know how to debug this problem. Plus I
  couldn't find any information on the internet that is even
  remotely related to this problem.</p>
  
  <p>I really hope that you can help me out here and ANY hint is
  greatly appreciated :)</p>