Roger the Shrubber;619688 Wrote:
> Thank you very, very much for that extensive response. I think I'll take
> the file based approach indeed. There are three situations I'll have to
> think more about:
> - user manually boots up or wakes server
> - user manually hibernates server through the plugin
> - user manually shuts down or hibernates server some other way
>
> in both cases, the block would not be set. 1st case could be solved by
> setting a block when starting up, but that does not work when coming
> from stand-by or hibernate. 2nd case can be avoided by using a custom
> command line for the hibernate command (Is that custom command also
> used when hibernate is activated after idle? That would take care of
> some of the instances of case 1 as well). 3rd case seems impossible to
> deal with in windows.
> Anyway, if I implement these partial solutions, one has to be quite
> unlucky to end up in a case that isn't covered.
>
>
> On a different note, regarding the netstat window popping up, could you
> use 'start /min netstat' or 'cmd /C start /min netstat' or something
> similar?
RE NETSTAT WINDOW:[/B] BECAUSE I'M USING PERL BACKTICKS, I.E. `NETSTAT
-E`, I DON'T THINK THE OTHER APPROACHES WILL WORK. PERL NEEDS TO READ
THE CONSOLE'S STDOUT. I'VE DONE SOME GOOGLING ON THIS AND HAVEN'T
FOUND A SOLUTION. I THINK WHAT I NEED TO DO IS WRITE MY OWN WINDOWS
UTILITY (WHICH I STARTED YESTERDAY) WHICH WILL POST THE STATS TO
SRVRPOWERCTRL VIA THE CLI.
[B]RE THREE SITUATIONS TO THINK ABOUT:
-- USER MANUALLY BOOTS UP OR WAKES SERVER-
On wake-up, you can have SrvrPowerCtrl execute an "Optional on-wakeup
command"...something like:
Code:
--------------------
c:\windows\system32\cmd.exe /cc:\path_to\test-time.cmd
--------------------
test-time.cmd could be a simple batch file that parses the current time
and then sets a block if the time falls within a given range. Perhaps
something like:
test-time.cmd:
Code:
--------------------
@echo off
rem Set the location of the block file..
if exist %ProgramData%\temp (
set BLOCKFILE=%ProgramData%\TEMP\spc-block
) else (
set BLOCKFILE=%windir%\temp\spc-block
)
rem Parse the time..
FOR /F "tokens=1-3 delims=:." %%A IN ("%TIME%") DO (
SET HOUR=%%A
SET MINUTE=%%B
SET SECOND=%%C
)
echo %HOUR% : %MINUTE% : %SECOND%
rem Set a SrvrPowerCtrl block if we're in a particular time period..
rem Block between Noon and 6 pm..
if /I %HOUR% geq 12 (
if /I %HOUR% lss 18 (
echo Creating the Noon to 6pm block..
echo Block! >%BLOCKFILE%
)
)
rem Block between 8pm and 10 pm
if /I %HOUR% geq 20 (
if /I %HOUR% lss 22 (
echo Creating the 8pm to 10 pm block..
echo Block! >%BLOCKFILE%
)
)
:end
--------------------
-- USER MANUALLY HIBERNATES SERVER THROUGH THE PLUGIN:-
If a block is set, users can't perform any SrvrPowerCtrl
actions...they're blocked.
-- USER MANUALLY SHUTS DOWN OR HIBERNATES SERVER SOME OTHER WAY-
Hard to protect against this using software. Armed guards?
--
gharris999
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=48521
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins