Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disk_usage does not work #10

Closed
anlek opened this issue Jan 31, 2010 · 4 comments
Closed

disk_usage does not work #10

anlek opened this issue Jan 31, 2010 · 4 comments

Comments

@anlek
Copy link

anlek commented Jan 31, 2010

I believe that the actual call for usage fails

Line 21 in disk_usage.rb
usage = df -P | grep -i " #{self.mount_point}$" | awk '{print $5}' | sed 's/%//'
should be
usage = df -P | grep -i #{self.mount_point} | awk '{print $5}' | sed 's/%//'

At least that's what I think it should be.

Andrew

@mojombo
Copy link
Owner

mojombo commented Apr 4, 2010

This works for me on OSX and Debian Linux. What operating system are you on? The reason that a space is included in the regex is so that a mount_point of /rw would not accidentally match something like /lib/init/rw.

@anlek
Copy link
Author

anlek commented Apr 4, 2010

Actually, I might have been wrong. I tested the command on Ubuntu and it didn't return a correct result and after I read a few blogs and tested it again a few weeks later, it worked fine. So please close off the issue.

@fguillen
Copy link

I have the same problem than anlek has before.

Ubuntu 10.4

$ df -P | grep sda1
/dev/sda1             19610300   3112624  15700760      17% /

Actual regex:
$ df -P | grep -i " /dev/sda1$" | awk '{print $5}' | sed 's/%//'
$ (none results)

Modified regex:
$ df -P | grep -i "^/dev/sda1 " | awk '{print $5}' | sed 's/%//'
$ 17

Thanks for your work

f.

@fguillen
Copy link

I don't know if it could be a good idea to modify the valid? method so it could test that the regex responds with not empty result.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants