473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Timers and Services

Hello,

I've written a windows service and so far what it does is browse to a
shared directory on an extranet. Check to see if any files exist in
this folder, if any do, the service downloads, processes and then
uploads a response file back up to a different shared folder.
My Question:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.

Has anyone done something like this and if so how. I have been looking
around but can't seem to find any info on anything like this.

Thanks in Advance.

Nov 17 '05 #1
8 1500
Hi,

Why don't use a scheduled job instead?
Anyway, the answer shoudl be yes, I have a similar deployment, I do not use
itmers, I use FileSystemWatcher instead and it work fine, I create and
initialize the watcher in the onload and the process keep waiting until the
event is received.
The above solution is something you should consider, it's safer, in any
case do not hardcode the times, it could change later on and you would have
to redeploy your solution
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<Pa*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hello,

I've written a windows service and so far what it does is browse to a
shared directory on an extranet. Check to see if any files exist in
this folder, if any do, the service downloads, processes and then
uploads a response file back up to a different shared folder.
My Question:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.

Has anyone done something like this and if so how. I have been looking
around but can't seem to find any info on anything like this.

Thanks in Advance.

Nov 17 '05 #2
Hi,

Why don't use a scheduled job instead?
Anyway, the answer shoudl be yes, I have a similar deployment, I do not use
itmers, I use FileSystemWatcher instead and it work fine, I create and
initialize the watcher in the onload and the process keep waiting until the
event is received.
The above solution is something you should consider, it's safer, in any
case do not hardcode the times, it could change later on and you would have
to redeploy your solution
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<Pa*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hello,

I've written a windows service and so far what it does is browse to a
shared directory on an extranet. Check to see if any files exist in
this folder, if any do, the service downloads, processes and then
uploads a response file back up to a different shared folder.
My Question:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.

Has anyone done something like this and if so how. I have been looking
around but can't seem to find any info on anything like this.

Thanks in Advance.

Nov 17 '05 #3
The windows task sheduler has been disabled and I'm not allowed to use
it.
I can't use the FileSystemWatcher as the folders exist on an extranet
and I can't set up any webfolders on my server.

Sorry I forgot to mention that in the previous post

regards
Paul

Nov 17 '05 #4
The windows task sheduler has been disabled and I'm not allowed to use
it.
I can't use the FileSystemWatcher as the folders exist on an extranet
and I can't set up any webfolders on my server.

Sorry I forgot to mention that in the previous post

regards
Paul

Nov 17 '05 #5
On 31 Aug 2005 06:28:06 -0700, Pa*********@gmail.com wrote:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.


Set your Windows service to start automatically, this way it will be always
running. Then use a System.Threading.Timer for you sheduled jobs. One of
its overloaded constructors takes 2 TimeSpan as parameters. The first one
is the time before the first callback invoke (set it to the time remaining
before 4am) and the second one is the time between 2 callback invokes (set
it to 20 minutes). When the callback method is invoked, check the time: if
it's 6am or later, Dispose your timer to stop it and recreate one for the
next day; if it's before 6am, do whatever you have to do.

Be carefull not to use using a System.Timers.Timer as it seems to be buggy
when used whithin a Windows Service (see
http://support.microsoft.com/default...b;en-us;842793)
Nov 17 '05 #6
On 31 Aug 2005 06:28:06 -0700, Pa*********@gmail.com wrote:
I would like to be able to start this service at 4am every day(I know
the download files won't be there until then)...then I want the service
to check for the files every say 20 mins until say 6am and then stop
chcking for the files until 4am the next day.


Set your Windows service to start automatically, this way it will be always
running. Then use a System.Threading.Timer for you sheduled jobs. One of
its overloaded constructors takes 2 TimeSpan as parameters. The first one
is the time before the first callback invoke (set it to the time remaining
before 4am) and the second one is the time between 2 callback invokes (set
it to 20 minutes). When the callback method is invoked, check the time: if
it's 6am or later, Dispose your timer to stop it and recreate one for the
next day; if it's before 6am, do whatever you have to do.

Be carefull not to use using a System.Timers.Timer as it seems to be buggy
when used whithin a Windows Service (see
http://support.microsoft.com/default...b;en-us;842793)
Nov 17 '05 #7
Thanks Mehdi....

You've given me a great starting point....I'

I'll give it a bash and see how I progress!

Nov 17 '05 #8
Thanks Mehdi....

You've given me a great starting point....I'

I'll give it a bash and see how I progress!

Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dmitry Demchuk | last post by:
Hi everybody. Recently I ran into situation with System.Threading.Timer in my ASP.NET application. I reinstalled Windows on one of my servers and got timers stop firing events after while, they...
1
by: Jason | last post by:
Hi all just a quick question. I have a windows service with a "Catalogue" class. I would like to know: if i put two "ServiceTimer" objects in my service 1. Do they run in separate threads...
3
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My...
9
by: Mark Rae | last post by:
Hi, I've seen several articles about using System Timers in ASP.NET solutions, specifically setting them up in Global.asax' Application_OnStart event. I'm thinking about the scenario where I...
1
by: james.e.coleman | last post by:
Hello, System.Timers.Timer/System.Threading.Timer do not fire on my development server, yet they work perfectly on the production server. I would appreciate any help on what the cause of this...
1
by: jeff | last post by:
Greetings; Newbie here, please forgive my ignorance of the vb.net threading model. I am developing a windows service which is driven by a variable number of timers. All timers use the same...
2
by: jeff | last post by:
Greetings; Newbie here, please forgive my ignorance of the vb.net threading model. I am developing a windows service which is driven by a variable number of timers. All timers invoke the same...
2
by: cntams | last post by:
All, I have a Windows Service and it has one System.Timers.Timer that fires every 500 milliseconds. Now I have noticed that there's a bug in System.Timers.Timer when it's being used combined with...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.