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: 581 / 1275
Referenced in: #1001248 - Public Comm Bot with forwarding (LIVE)
#1001364 - Periodic rebooter (once every 24h)
#3000195 - Answer for stefanreich (>> y)
#3000196 - Answer for stefanreich (>> y)
#3000197 - Answer for stefanreich (>> program data sizes)
#3000198 - Answer for stefanreich (>> program data sizes)
#3000199 - Answer for stefanreich (>> program data sizes)
#3000200 - Answer for stefanreich (>> program data sizes)
#3000201 - Answer for stefanreich (>> list all files)
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000238 - Answer for stefanreich (>> t power bot)
#3000382 - Answer for ferdie (>> t = 1, f = 0)