0

I've got an old Windows NT Server machine that doesn't have a scheduled tasks feature. I know about AT, but I need to schedule a task to run every 5 minutes. I've looked at cron for windows, but I don't really know anything about it (is it any good?)

What are some good alternatives to scheduled tasks?

Kara Marfia
  • 7,892
  • 5
  • 33
  • 57
scottm
  • 359
  • 3
  • 5
  • 19

5 Answers5

1

Only a modem and not much desire to download big installs, eh?

You can do what we did "back in the day" with the "AT" scheduler:

@echo off
for /l %%i in (0,1,23) do (
  for /l %%d in (0,5,55) do (
   at %%i:%%d /EVERY:M,T,W,Th,F,S,Su "c:\cron\five-minutes.cmd"
  )
)

It's a hack, but it works! It's only 288 entries-- the box really can handle it fine.

Evan Anderson
  • 141,881
  • 20
  • 196
  • 331
0

At this point, I'll do anything to avoid interacting with NT. Can you schedule the task from another server using psexec to execute it on the NT box? Yes, it's hackish, but the lesser evil versus touching NT. ;)

Kara Marfia
  • 7,892
  • 5
  • 33
  • 57
  • 1
    Bah! Touching NT isn't that bad. I won't touch Windows 9X anymore (I break out in hives), but NT is fine. It's a little bit like talking politics with my grandparents. It's out of touch and a bit backward, but in an endearing way. It's still basically a good, decent operating system, but it came from a simpler time. Some of its eccentricities (anonymous SID resolution, privileged APIs with improperly validated inputs) are socially unacceptable today, but back when it was growing up... (Okay, I've taken the analogy a little too far!) – Evan Anderson Jul 10 '09 at 19:33
0

Task Scheduler will be available if you install the offline browsing pack.

Microsoft KB article

Jeremy Viet
  • 596
  • 2
  • 7
  • Since the offline browsing pack was a component of IE5, here's a link for 5.5, which should still contain the necessary files. http://www.brothersoft.com/internet-explorer-download-60634.html – Jeremy Viet Jul 10 '09 at 19:00
  • Yeah, I know about that. I'm really looking for an alternative. This is a computer that only has modem access and I don't really want to upload the 84MB IE install. – scottm Jul 10 '09 at 19:01
0

Do you need to run the task every 5 minutes indefinitely? If so, you grab a copy of the sleep.exe file from the Windows 2003 Resource Kit and set up a batch file like this:

:start
yourtask.exe
sleep 600
goto start

Note that I haven't actually tested the sleep command on Windows NT, but it should work.

Anthony Lewis
  • 909
  • 7
  • 8
0

I have a few legacy servers where I have to do this sort of thing, and I use:

rem Get the day number. When the day number changes that signals
rem the script to exit.

for /f "tokens=1" %%i in ('date /t') do set THEDATE=%%i
set THEDAY=%THEDATE:~0,2%

rem Start the loop

:start

rem Execute comamnds

echo Run your command here

rem Pause for 5 minutes

sleep 15
rem or ping 1.1.1.1 -n 300 if you don't have sleep.exe

rem Check the day number. If it is still the same loop back to the
rem start of the monitoring loop.

for /f "tokens=1" %%i in ('date /t') do set THEDATE=%%i
if %THEDATE:~0,2% == %THEDAY% goto start

If you start this shortly after midnight it runs for 24 hours then stops, ready to be launched again.

JR

John Rennie
  • 7,776
  • 1
  • 23
  • 35