F
FB's .NET Dev PC
On one PC, I have several services, all of which need to run, some of which
I am writing, and some of which (such as SQL server) I am not writing.
My overall goal is to have a restartable, stable system. One of my services
is a "system monitor" which controls the startup of the other services I am
writing, based on the SQL server having started.
I am using WMI to monitor services, and
System.ServiceProcess.ServiceController to start and stop them. This works.
What I need to do, if all other conditions fail to resolve problems, is set
my System Monitor to "Manual" startup from the "Automatic" which I set as a
ServiceStartMode in the installer.
How can I change the start mode of a service from within that service (or
any other service, for that matter)?
Thanks
Fred Bourdelier
Tucson AZ
PS I use the code below to reboot the computer - this only works if no
service or app is hung. Is there a way to force a reboot through hanging
programs?
System.Diagnostics.Process.Start("shutdown", "-s -t 00")
System.Diagnostics.Process.Start("shutdown", "-r -t 00")
System.Diagnostics.Process.Start("shutdown", "-l -t 00")
I am writing, and some of which (such as SQL server) I am not writing.
My overall goal is to have a restartable, stable system. One of my services
is a "system monitor" which controls the startup of the other services I am
writing, based on the SQL server having started.
I am using WMI to monitor services, and
System.ServiceProcess.ServiceController to start and stop them. This works.
What I need to do, if all other conditions fail to resolve problems, is set
my System Monitor to "Manual" startup from the "Automatic" which I set as a
ServiceStartMode in the installer.
How can I change the start mode of a service from within that service (or
any other service, for that matter)?
Thanks
Fred Bourdelier
Tucson AZ
PS I use the code below to reboot the computer - this only works if no
service or app is hung. Is there a way to force a reboot through hanging
programs?
System.Diagnostics.Process.Start("shutdown", "-s -t 00")
System.Diagnostics.Process.Start("shutdown", "-r -t 00")
System.Diagnostics.Process.Start("shutdown", "-l -t 00")