A Restart Script Based on CPU

Discussion in 'Archived: Plugin Requests' started by Colby l, Jan 23, 2012.

  1. Offline

    Colby l

    Now i'm not sure if this could be a plugin or just a basic script, but I need a plugin/script that will restart my server if it reaches a certin amount of CPU. I've tried RMToolKit, MilkAdmin, and MCMyAdmin but they're CPU intensive for features I do not need. If someone could write up a script for it/Plugin, that would be highly appreciated.

    Thank You,
    AhellHound
     
  2. Well the reloading it bit is easy, i'm just not sure how to do the detection of CPU usage.
     
  3. Just use a syncRepeatingTask to check the current time every 20 ticks. If more than 1 second is over the server lags. Of course you shouldn't instantly reload, just if it lags for more than like 10 seconds.
     
  4. Offline

    TheReelaatiiv

    If your minecraft server runs on linux, you simply coul'd read minutewise out the load-average and if the load-average is over a setable limit, it restarts your server or pauses your server and resumes your server if the load-average goes below a setable limit.
     
  5. Offline

    beleg

    wouldnt that cause lag?
     
  6. Offline

    ZephyrSigmar

    Why would it cause lagg?
    It's just a simple check which is get done every 20L,but you can set it to a higher tick rate (to check about every 5 second).
     
  7. Not really, taking the timestamp every second and compare it to the previous saved is fast. A simple counter that adds +1 if there's lag or resets to 0 if not is also fast. ;)
     

Share This Page