Date: Fri, 9 Feb 2007 16:40:55 -0500 From: Mike Meyer <mwm-keyword-freebsdhackers2.e313df@mired.org> To: "Victor Loureiro Lima" <victorloureirolima@gmail.com> Cc: freebsd-fs@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: /usr/bin/du + crontab weird bug Message-ID: <17868.60007.226858.275351@bhuda.mired.org> In-Reply-To: <ac00e00a0702091335v79861961s1bfe637666e30b42@mail.gmail.com> References: <ac00e00a0702091335v79861961s1bfe637666e30b42@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In <ac00e00a0702091335v79861961s1bfe637666e30b42@mail.gmail.com>, Victor Loureiro Lima <victorloureirolima@gmail.com> typed: > Hello -hackers and -fs, > > Sorry for the cross-post but I didnt know where this particular post > belonged to... > In a .br FreeBSD related mailing-list a user seems to have a found a > bug when using /usr/bin/du and crontab together, I am posting it here > to see what responses we get: > > root@zion# du -s /etc > 2544 /etc > root@zion# cat /etc/crontab | grep du > 30 19 * * 5 root /usr/bin/du -s /etc >> /tmp/lele > root@zion# date > Fri Feb 9 19:29:30 BRST 2007 > root@zion# cat /tmp/lele > 5088 /etc > root@zion# du -s /etc > 2544 /etc > > What gives that when "/usr/bin/du -s" is running from crontab is gives > the exact double of entries in the directory but when it is running > from console itself, it doesnt display the same amount of > entries!?!?!?! du uses the BLOCKSIZE environment variable to decide what size blocks to display. Crontab commands don't run with your environment; they run with a very restricted one. This is documented in the du manual page. > Weird bug... Someone probably set BLOCKSIZE in your environment. Try using "du -sk" to force du to use 1k blocks. <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17868.60007.226858.275351>