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

13
LINES

< > BotCompany Repo | #1020340 // diskSpaceEtcBot_diskSpace

JavaX fragment (include)

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

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: 207 / 237
Referenced in: [show references]