Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1020340 // diskSpaceEtcBot_diskSpace

JavaX fragment (include)

sS diskSpaceEtcBot_diskSpace() {
  File f = userDir();
  //print("Using dir: " + f);
  long total = f.getTotalSpace();
  long usable = f.getUsableSpace();
  //print("Total/usable: " + total + "/" + usable);
  S a = "Server disk space: " + toM(usable) + " MB free of " + toM(total) + " MB.";
  if (!isWindows()) pcall {
    S[] inodes = toLines(backtick("df -hi " + bashQuote(f.getPath()))).get(1).split(" +");
    a += " Free inodes: " + inodes[3] + "/" + inodes[1];
  }
  ret a;
}

Author comment

Began life as a copy of #1013097

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020340
Snippet name: diskSpaceEtcBot_diskSpace
Eternal ID of this version: #1020340/1
Text MD5: 06e68ef9e9ae16514fd41c1a9db0c8d7
Author: stefan
Category: javax / talking robots
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-14 18:49:06
Source code size: 493 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 203 / 234
Referenced in: [show references]