![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Delay a Windows Service to start
Bonjour!
I have a service that I want to delay because it needs to be up before end. So I created a Windows service (Delay Service) and my application will start after that service has started but it doesn't work. In the OnStart of the service I loop for one minute, but when I install the service and start, it automatically say's it is started even if I have that loop. Does someone had a similar and how did you solved it?? Regards Joel ![]() |
|
|||
|
Re: Delay a Windows Service to start
"Joel" <Joel@discussions.microsoft.com> wrote in message news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com... > Bonjour! > I have a service that I want to delay because it needs to be up before > end. > So I created a Windows service (Delay Service) and my application will > start > after that service has started but it doesn't work. In the OnStart of the > service I loop for one minute, but when I install the service and start, > it > automatically say's it is started even if I have that loop. > Does someone had a similar and how did you solved it?? > > Regards Joel ![]() How did you create this service? What are its commands? How did you implement the delay? |
|
|||
|
Re: Delay a Windows Service to start
Hi!
I took VS 2005 with the help of an article http://msdn2.microsoft.com/en-us/lib...8a(VS.80).aspx In the onStart I just put a loop because I tought that the service was changing is status to started after going in the OnStart event. I'm really not a Windows Service programmer specialist. Regards, Joel ![]() "Pegasus (MVP)" wrote: > > "Joel" <Joel@discussions.microsoft.com> wrote in message > news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com... > > Bonjour! > > I have a service that I want to delay because it needs to be up before > > end. > > So I created a Windows service (Delay Service) and my application will > > start > > after that service has started but it doesn't work. In the OnStart of the > > service I loop for one minute, but when I install the service and start, > > it > > automatically say's it is started even if I have that loop. > > Does someone had a similar and how did you solved it?? > > > > Regards Joel ![]() > > How did you create this service? What are its commands? > How did you implement the delay? > > > |
|
|||
|
Re: Delay a Windows Service to start
Hmmm... Maybe you should be posting this under VS's newsgroup?
-- Jabez Gan Microsoft MVP: Windows Server http://www.msblog.org "Joel" <Joel@discussions.microsoft.com> wrote in message news:4FE66034-A426-4F99-ADE2-FB30C5C0DEF2@microsoft.com... > Hi! > I took VS 2005 with the help of an article > http://msdn2.microsoft.com/en-us/lib...8a(VS.80).aspx > In the onStart I just put a loop because I tought that the service was > changing is status to started after going in the OnStart event. I'm really > not a Windows Service programmer specialist. > > Regards, Joel ![]() > "Pegasus (MVP)" wrote: > >> >> "Joel" <Joel@discussions.microsoft.com> wrote in message >> news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com... >> > Bonjour! >> > I have a service that I want to delay because it needs to be up before >> > end. >> > So I created a Windows service (Delay Service) and my application will >> > start >> > after that service has started but it doesn't work. In the OnStart of >> > the >> > service I loop for one minute, but when I install the service and >> > start, >> > it >> > automatically say's it is started even if I have that loop. >> > Does someone had a similar and how did you solved it?? >> > >> > Regards Joel ![]() >> >> How did you create this service? What are its commands? >> How did you implement the delay? >> >> >> |
|
|||
|
Re: Delay a Windows Service to start
Ok Thanks
"Jabez Gan [MVP]" wrote: > Hmmm... Maybe you should be posting this under VS's newsgroup? > > -- > Jabez Gan > Microsoft MVP: Windows Server > http://www.msblog.org > > > "Joel" <Joel@discussions.microsoft.com> wrote in message > news:4FE66034-A426-4F99-ADE2-FB30C5C0DEF2@microsoft.com... > > Hi! > > I took VS 2005 with the help of an article > > http://msdn2.microsoft.com/en-us/lib...8a(VS.80).aspx > > In the onStart I just put a loop because I tought that the service was > > changing is status to started after going in the OnStart event. I'm really > > not a Windows Service programmer specialist. > > > > Regards, Joel ![]() > > "Pegasus (MVP)" wrote: > > > >> > >> "Joel" <Joel@discussions.microsoft.com> wrote in message > >> news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com... > >> > Bonjour! > >> > I have a service that I want to delay because it needs to be up before > >> > end. > >> > So I created a Windows service (Delay Service) and my application will > >> > start > >> > after that service has started but it doesn't work. In the OnStart of > >> > the > >> > service I loop for one minute, but when I install the service and > >> > start, > >> > it > >> > automatically say's it is started even if I have that loop. > >> > Does someone had a similar and how did you solved it?? > >> > > >> > Regards Joel ![]() > >> > >> How did you create this service? What are its commands? > >> How did you implement the delay? > >> > >> > >> > > |
|
|||
|
Re: Delay a Windows Service to start
I can't comment on your method since I have not tried it so
far. However, the following method will work. It will start the "Windows Time" service some 60 seconds after you start your own custom-made service. 1. Create the batch file c:\Windows\Joel.bat with these lines: @echo off %SystemRoot%\System32\cmd.exe /c echo Start %time% >> c:\test.txt %SystemRoot%\System32\ping.exe localhost -n 60 %SystemRoot%\System32\net.exe start "Windows time" %SystemRoot%\System32\cmd.exe /c echo End %time% >> c:\test.txt %SystemRoot%\System32\cmd.exe /c echo. >> c:\test.txt 2. Go through the motions of this KB article: http://support.microsoft.com/kb/137890 When entering the data for the "Application" value, enter this: c:\windows\system32\cmd.exe /c c:\windows\Joel.bat 3. Manually stop the "Windows Time" service. 4. Manually start the service you have just created under the guidance of the KB article. 5. Check the contents of c:\test.txt. 6. Adjust c:\windows\Joel.bat to suit your requirements. "Joel" <Joel@discussions.microsoft.com> wrote in message news:4FE66034-A426-4F99-ADE2-FB30C5C0DEF2@microsoft.com... > Hi! > I took VS 2005 with the help of an article > http://msdn2.microsoft.com/en-us/lib...8a(VS.80).aspx > In the onStart I just put a loop because I tought that the service was > changing is status to started after going in the OnStart event. I'm really > not a Windows Service programmer specialist. > > Regards, Joel ![]() > "Pegasus (MVP)" wrote: > >> >> "Joel" <Joel@discussions.microsoft.com> wrote in message >> news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com... >> > Bonjour! >> > I have a service that I want to delay because it needs to be up before >> > end. >> > So I created a Windows service (Delay Service) and my application will >> > start >> > after that service has started but it doesn't work. In the OnStart of >> > the >> > service I loop for one minute, but when I install the service and >> > start, >> > it >> > automatically say's it is started even if I have that loop. >> > Does someone had a similar and how did you solved it?? >> > >> > Regards Joel ![]() >> >> How did you create this service? What are its commands? >> How did you implement the delay? >> >> >> |
|
|||
|
Re: Delay a Windows Service to start
WoW! I think that will work, I really appriciate your answer,
Regards, Joel ![]() "Pegasus (MVP)" wrote: > I can't comment on your method since I have not tried it so > far. However, the following method will work. It will start > the "Windows Time" service some 60 seconds after you > start your own custom-made service. > > 1. Create the batch file c:\Windows\Joel.bat with these lines: > @echo off > %SystemRoot%\System32\cmd.exe /c echo Start %time% >> c:\test.txt > %SystemRoot%\System32\ping.exe localhost -n 60 > %SystemRoot%\System32\net.exe start "Windows time" > %SystemRoot%\System32\cmd.exe /c echo End %time% >> c:\test.txt > %SystemRoot%\System32\cmd.exe /c echo. >> c:\test.txt > > 2. Go through the motions of this KB article: > http://support.microsoft.com/kb/137890 > When entering the data for the "Application" value, enter this: > c:\windows\system32\cmd.exe /c c:\windows\Joel.bat > > 3. Manually stop the "Windows Time" service. > > 4. Manually start the service you have just created under the guidance > of the KB article. > > 5. Check the contents of c:\test.txt. > > 6. Adjust c:\windows\Joel.bat to suit your requirements. > > > "Joel" <Joel@discussions.microsoft.com> wrote in message > news:4FE66034-A426-4F99-ADE2-FB30C5C0DEF2@microsoft.com... > > Hi! > > I took VS 2005 with the help of an article > > http://msdn2.microsoft.com/en-us/lib...8a(VS.80).aspx > > In the onStart I just put a loop because I tought that the service was > > changing is status to started after going in the OnStart event. I'm really > > not a Windows Service programmer specialist. > > > > Regards, Joel ![]() > > "Pegasus (MVP)" wrote: > > > >> > >> "Joel" <Joel@discussions.microsoft.com> wrote in message > >> news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com... > >> > Bonjour! > >> > I have a service that I want to delay because it needs to be up before > >> > end. > >> > So I created a Windows service (Delay Service) and my application will > >> > start > >> > after that service has started but it doesn't work. In the OnStart of > >> > the > >> > service I loop for one minute, but when I install the service and > >> > start, > >> > it > >> > automatically say's it is started even if I have that loop. > >> > Does someone had a similar and how did you solved it?? > >> > > >> > Regards Joel ![]() > >> > >> How did you create this service? What are its commands? > >> How did you implement the delay? > >> > >> > >> > > > |
|
|||
|
Re: Delay a Windows Service to start
You can probably improve the method by adding this line
to your batch file: %SystemRoot%\System32\net.exe stop "NameOfYourService" since there is no need for your service to keep on running after it has delay-started the original service. Let me know how you go! "Joel" <Joel@discussions.microsoft.com> wrote in message news:1E1B9C32-A6B3-42B0-8880-A197B460FBE7@microsoft.com... > WoW! I think that will work, I really appriciate your answer, > > Regards, Joel ![]() > > "Pegasus (MVP)" wrote: > >> I can't comment on your method since I have not tried it so >> far. However, the following method will work. It will start >> the "Windows Time" service some 60 seconds after you >> start your own custom-made service. >> >> 1. Create the batch file c:\Windows\Joel.bat with these lines: >> @echo off >> %SystemRoot%\System32\cmd.exe /c echo Start %time% >> c:\test.txt >> %SystemRoot%\System32\ping.exe localhost -n 60 >> %SystemRoot%\System32\net.exe start "Windows time" >> %SystemRoot%\System32\cmd.exe /c echo End %time% >> c:\test.txt >> %SystemRoot%\System32\cmd.exe /c echo. >> c:\test.txt >> >> 2. Go through the motions of this KB article: >> http://support.microsoft.com/kb/137890 >> When entering the data for the "Application" value, enter this: >> c:\windows\system32\cmd.exe /c c:\windows\Joel.bat >> >> 3. Manually stop the "Windows Time" service. >> >> 4. Manually start the service you have just created under the guidance >> of the KB article. >> >> 5. Check the contents of c:\test.txt. >> >> 6. Adjust c:\windows\Joel.bat to suit your requirements. >> >> >> "Joel" <Joel@discussions.microsoft.com> wrote in message >> news:4FE66034-A426-4F99-ADE2-FB30C5C0DEF2@microsoft.com... >> > Hi! >> > I took VS 2005 with the help of an article >> > http://msdn2.microsoft.com/en-us/lib...8a(VS.80).aspx >> > In the onStart I just put a loop because I tought that the service was >> > changing is status to started after going in the OnStart event. I'm >> > really >> > not a Windows Service programmer specialist. >> > >> > Regards, Joel ![]() >> > "Pegasus (MVP)" wrote: >> > >> >> >> >> "Joel" <Joel@discussions.microsoft.com> wrote in message >> >> news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com... >> >> > Bonjour! >> >> > I have a service that I want to delay because it needs to be up >> >> > before >> >> > end. >> >> > So I created a Windows service (Delay Service) and my application >> >> > will >> >> > start >> >> > after that service has started but it doesn't work. In the OnStart >> >> > of >> >> > the >> >> > service I loop for one minute, but when I install the service and >> >> > start, >> >> > it >> >> > automatically say's it is started even if I have that loop. >> >> > Does someone had a similar and how did you solved it?? >> >> > >> >> > Regards Joel ![]() >> >> >> >> How did you create this service? What are its commands? >> >> How did you implement the delay? >> >> >> >> >> >> >> >> >> |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|