473,385 Members | 1,587 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,385 software developers and data experts.

Windows service management

Hi,

I run a windows service, every 30 minutes.
The tasks in the service can take one time 30 minutes, one time 1 hour, and
one time 10 minutes or less, it depends on the data that the user supplies to
the system.
How can I prevent a situation that a new cycle of the service start before
the previous completes?

Thanks in advance.

Aug 9 '06 #1
3 1747
mutex - e.g. (from Jon's page)
http://www.yoda.arachsys.com/csharp/...ation.instance

Marc
Aug 9 '06 #2
Thanks Marc,
I will try it.

"Marc Gravell" wrote:
mutex - e.g. (from Jon's page)
http://www.yoda.arachsys.com/csharp/...ation.instance

Marc
Aug 9 '06 #3
Assuming that the service has its own built-in timer that runs the job, you
can put a conditional statement in the timer's Elapsed event handler, which
checks to see if a job is already running, and stops the timer if it is. It
can then start a new job and reset the timer as soon as the job is complete.
The way it knows whether to let the timer's Elapsed event handler start the
job, or whether the job should be restarted immediately, you just check the
Timer's Enabled property. If it is Enabled, the job did not extend beyond
the interval and stop it; therefore it does not have to restart itself. If
it is disabled, the job extended beyond the interval, stopping the timer in
the process, and it needs to restart itself.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Accept the Unexpected.

"Niron kag" <Ni******@discussions.microsoft.comwrote in message
news:07**********************************@microsof t.com...
Hi,

I run a windows service, every 30 minutes.
The tasks in the service can take one time 30 minutes, one time 1 hour,
and
one time 10 minutes or less, it depends on the data that the user supplies
to
the system.
How can I prevent a situation that a new cycle of the service start before
the previous completes?

Thanks in advance.

Aug 9 '06 #4

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

Similar topics

0
by: Ger | last post by:
Hi, I have a problem with a Windows Service that I have created accessing System.Management.dll on a W2k3 environment. The Service runs fine on an XP machine but the same Service causes an error...
1
by: Sean | last post by:
Hi. I'm converting a project which uses windows form UI to Windows service. I just finished converting but I can't use any UI (winform or console). can't Windows Service use UI? then what...
7
by: Mike | last post by:
I want to create a windows service that will monitor another window service. what i need for the service to do is, if a service is stopped I need it to start the service back up example: ...
2
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be...
0
by: MaxBici | last post by:
Hi, I have a windows service in C# (.NET framework 1.1) running on Windows XP PRO SP2. This service essentiallt starts a printjob watcher. Please see the code snippet below. queryInterval =...
10
by: Ger | last post by:
I am having problems using VB.Net's Management base object on a machine hosting Windows Server 2003. I am trying to set file permissions from a Windows Service. These files may be loacted on a...
3
by: Rob | last post by:
Can a form be opened from a Windows service? I have a windows service that I would like to open a form from a notify icon. I cannot get the Notify Icon to display nor can I open a form. Any...
1
by: =?Utf-8?B?UGllcnJl?= | last post by:
Hello, I have an simle application that uses a referenced library of my own. It's been a year now that I have no problems until a few days. Here is the details of my problem: The library...
2
by: Vadim Malishev | last post by:
Hello, Can anybody help to solve the following problem? My Windows Service trying to access remote machine to get WindowsDirectory Property over Win32_OperatingSystem WMI class. Both servers...
7
by: sachinkale123 | last post by:
I want to stop Sql server Agent Windows service. I am using below code to stop or start the windows service. Which is I am doing sucessfully. ManagedComputer mc = default(ManagedComputer); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.