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

31
LINES

< > BotCompany Repo | #1001218 // Reboot Bot (Linux/Windows)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1801L/12K/40K).

!747

m {
  static new L<long> rebootLog;
  
  p {
    readLocally("rebootLog");
    makeAndroid("Reboot Bot.");
  }
  
  static synchronized S answer(S s) {
    if (match3("Please reboot the machine.", s)) {
      final S cmd = isWindows() ? "shutdown -t 5 -r" : "reboot";
      print(cmd);
      S answer = "Rebooting in 5 seconds!";
      print(answer);
      rebootLog.add(now());
      saveLocally("rebootLog");
      thread {
        sleepSeconds(5);
        backtick(cmd);
      }
      return answer;
    }
    
    if (match3("How many reboots have you done?", s))
      return "" + rebootLog.size();
    
    return null;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, dhtvkmknsjym, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001218
Snippet name: Reboot Bot (Linux/Windows)
Eternal ID of this version: #1001218/1
Text MD5: b4f4462aca7e05d49bc524d4490d0bbd
Transpilation MD5: 74d7e2dd377b6eb501fa3c1b2ed8bc2f
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-11-13 17:29:34
Source code size: 667 bytes / 31 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 480 / 1144
Referenced in: [show references]