Equiv of a CRON job?

A

Andrew Banks

When I've developed PHP sites before we've had a server facility called a
CRON job to set a certain page to run at pre-defined periods (schedule it)

Is there an equvalent for ASP.NET/IIS? I've got some scripts which I could
do with running daily and wondered the best way to do this?
 
K

Kevin Spencer

You have a couple of alternatives. The closest fit to your problem would be
a Windows Service that can perform a scheduled task. That would require
installing the Service on the host machine, which may or may not be
possible. Another alternative is to include code in your Session_OnStart
Event Handler, which checks the date and time and runs or doesn't run a task
at the beginning of a user's Session.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
A

Andrew Banks

First option seems more reliable but I won't have that option as I'm on a
shared server.

Second option is good but not as reliable. If no one visitis the site, no
sessions are started and hence nothing will be run.

Does anyone know any other alternatives?
 
S

Scott

You could just run a scheduled task (outside of IIS/ASP); I guess it depends on your scripts.

Scott
 
B

Bryan Donaldson

the Windows system equivalent to CRON is "AT"

The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computer] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on
the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted,
the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.
 
A

Alex Papadimoulis

Andrew,

Unless your host will allow you to run a scheduled task (try askin them), it
looks like you're out of luck. If you post the specific task your trying to
do, perhaps we can help you with some work arounds.

Alex Papadimoulis
 
J

John Timney \(Microsoft MVP\)

Iif you have the ability to create applications - you could try spawning a
thread in application on_start that sits ticking away doing your schedule
check.

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top