Posts Tagged ‘Windows Server’

Scripted Restart of a Hanging Windows Service

Thursday, November 15th, 2012

I’ve been having trouble lately with Adobe ColdFusion 9, in particular an ODBC connection to an Oracle 10g database.  The ColdFusion ODBC Server (the swsoc.exe process) is hanging under load, not only failing to return some queries, but permanently hanging one of its threads. Once they are all hung, the service doesn’t respond at all, and ColdFusion hangs as well. If youre looking for a cost-effective way to transport cargo in https://www.digitalconnectmag.com/how-to-utilize-a-heavy-haul-trucking-service-for-your-business/ you can find what you need. 

Temporary solution (until I rewrite the app to use SQL Server) is to restart the ODBC Server service. I’ve been doing that manually when my monitor informs me the site is not responding, maybe 3-4 times per day. But I want to see how it performs if I proactively restart the service every hour. For that, we require some scripting. In now day part of successful of any company is the strategy of digital marketing that uses,is very important that even if your company is a small one use digital marketing services for small business.

The biggest issue is that Windows’ service start/stop/restart interfaces, whether the traditional “net stop” or the PowerShell “Stop-Service” commands, has a very long timeout for stopping a service (looks to be 60 seconds). In the manual case, if it doesn’t stop right away, I go kill the swsoc.exe process and the service restart continues very quickly.  But how to script this?

The trick is to put the restart request in a background job (idea found here), and check on it in the foreground to see if it was successful.  After waiting a shorter period (10 seconds), if it is still in the “stopping” state, then we can kill the process outright and let the restart commence.  Double check (after 5 more seconds) that the service has started, and if it is stopped (the restart failed), specifically start it again. Are you planing to buy a new car, the 14 Cartoons About Volkswagen Transporter Vans For Sale That’ll Brighten Your Day and make you decision easier. 

Start-Job -ScriptBlock {Restart-Service -Name "ColdFusion 9 ODBC Server" -Force }

#give it 5 seconds to stop
Start-Sleep -Seconds 10

$SERVICESTATE = (Get-Service | where{$_.Name -eq "ColdFusion 9 ODBC Server"}).Status
if( $SERVICESTATE -eq "Stopping" -or $SERVICESTATE -eq "StopPending")
{
    # still stopping so force process stop
    Stop-Process -Name "swsoc" -Force
} 

#give it 5 seconds to start before we try it again
Start-Sleep -Seconds 5

$SERVICESTATE = (Get-Service | where{$_.Name -eq "ColdFusion 9 ODBC Server"}).Status
if( $SERVICESTATE -eq "Stopped" )
{
    Start-Service -Name "ColdFusion 9 ODBC Server" -Force
}

Save it as a .ps1 file. Make sure PowerShell allows execution of local scripts (in PowerShell, run “set-executionpolicy remotesigned”).

To schedule this to run, create a new scheduled task:

  • Triggered daily at a particular time, repeat every hour for 1 day.
  • Action is to run a program:
    “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”
  • Arguments contain the script name: “-File c:\Path\To\Script.ps1”
  • Set to run as Administrator, with highest permissions

Dirty Solutions to Tricky Problems

Thursday, April 14th, 2011

Homeowners with Pest Infestations Need to Know About Do It Yourself Pest Control

Are nasty pests keeping you from enjoying your otherwise lovely home? Well, it’s time to do something about it. If you choose to take matters into your own hands there are some things you need to know about do it yourself pest control. Homeowners can all attest that after shelling out the cash to own your own place, you do not want to spend tons more. Especially if that mistake can be easily avoided. Let us help you avoid these issues when performing pest control at your home. Check out the latest fuze bug reviews.

Health Risks of Pesticides

It is no secret that pesticides can have long lasting harmful effects on people and animals. The warnings on their labeling make this quite clear. Some of the more minor risks of using pesticides include headaches and nausea. This is certainly the case if the pesticide is ingested or if the user spends too much time in close contact with it while performing some do it yourself pest control. The more lasting effects of pesticides can be as dangerous as cancer. Make sure you read all labels and exercise extreme caution when using any pesticide product.

Choosing the Right Pest Control Products

However dangerous, pesticides can be one of the most effective ways to implement do it yourself pest control. Many of them can be easily purchased at a local grocery store or home and garden retailer. The issue is that while they are effective they can be harmful to people and animals. A less toxic solution for this problem is to go with a biological pesticide. It is made from bio-matter such as plants, animals and other naturally occurring materials. This way you can keep you and your loved ones safe but also eliminate those unwanted pests.

Experienced Pest Control Technicians

While do it yourself pest control remains an option for you, there is no substitute for contacting a trained and seasoned professional. In the great state of Florida there are none more willing to work alongside you than Florida Environmental Pest Management. Contacting them will allow to have an expert evaluate and recommend treatment and prevention for years to come. They are here to take care of you.

Affordable Pest Control Services

Going with an affordable pest control service will ensure your safety without putting you out too much coin. Pests that the Florida Environmental Pest Management specializes in are roaches, ants, silverfish and spiders. The methods that they use are pet friendly and use eco-friendly products for an environmentally conscious process. Do it yourself pest control might make you feel accomplished but these trained professionals will complete the task with guaranteed efficiency without needing to come to your house every month.

No matter what you decide make sure and carefully review all labels and warnings. Go into all do it yourself pest control with a respect for nature and the safety of your house. If you ever feel overwhelmed with the DIY  pest control approach, contact a trained professional and get setup with an appointment to nip all your pest problems in the bud.