Idle state detection for server

2

Windows OS has a service that detects idle state. Details: Task Idle Conditions

The computer is considered idle if all the processors and all the disks were idle for more than 90% of the past 15 minutes and if there is no keyboard or mouse input during this period of time. When the Task Scheduler service detects that the computer is idle, the service only waits for user input to mark the end of the idle state.

It is very useful for usual PCs that have keyboard amd mouse. We can use standard task scheduler to start some process like defrag when PC in idle state and stop when PC isn't in idle state.

But what should we use when we using a standalone server without keyboard and mouse? Server sometimes receives commands by TCP/IP and starts CPU and HDD activity. But sometimes CPU and HDD activity at zero level.

I would like to use this periods of time to start defrag or another process. But this started at "idle" state processes should be terminated when another commands will appear. So, standard idle state conditions cant help me because we have not got user input to stop idle state. I need more customizable idle state detector. Automatically started processes shouldn't influence to idle state, but PC should go away from idle state when another process will apperar. What should I use?

Maybe exists some advansed task scheduler? Or I should write some useful utility on C#?

I hope that it is a standard task and all useful utilities already compiled :)

odinmillion

Posted 2012-11-22T10:02:11.827

Reputation: 121

Answers

-1

if no user input is available the server should monitor idle time itself using

BOOL WINAPI GetSystemTimes(
  _Out_opt_ LPFILETIME lpIdleTime,
  _Out_opt_ LPFILETIME lpKernelTime,
  _Out_opt_ LPFILETIME lpUserTime
);

constm

Posted 2012-11-22T10:02:11.827

Reputation: 1

This is really a comment and not an answer to the original question. You can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. Please read Why do I need 50 reputation to comment? What can I do instead?

– DavidPostill – 2016-11-16T23:54:33.560