PDA

View Full Version : Windows: Starting services from cmd line?



BKDotCom
2005-06-04, 19:39
I've tried "net start slimserver"

The SlimServer service is starting.....
The Slimserver service could not be started.

Starts fine from windows' services gui
what gives?

Since it crashes about ever 24hours I figured a shortcut to restart it would be dandy.

Maditude
2005-06-04, 23:11
I've tried "net start slimserver"

The SlimServer service is starting.....
The Slimserver service could not be started.

Starts fine from windows' services gui
what gives?

Since it crashes about ever 24hours I figured a shortcut to restart it would be dandy.
Look into the 'srvany' (google) utility to do what you want. I've used it at work, I can dig up some sample scripts I've used with it next Monday if you're stuck.

But, really, you should figure out what's causing the crash, and rectify that before trying to automate a restart. Any error messages?

BKDotCom
2005-06-05, 11:00
But, really, you should figure out what's causing the crash, and rectify that before trying to automate a restart. Any error messages?I'm using MySQL. If idle, slimserver looses it's connection to MySQL, but doesn't reconnect and crashes... known bug. I'm curious if this has been addressed in 6.0.3 or 6.1

JJZolx
2005-06-05, 11:22
I'm using MySQL. If idle, slimserver looses it's connection to MySQL, but doesn't reconnect and crashes... known bug. I'm curious if this has been addressed in 6.0.3 or 6.1

If you're having so many problems running with MySQL then why aren't you:

a) running SQLite

or

b) running latest nightlies that might address bugs with MySQL

?

BKDotCom
2005-06-05, 19:58
If you're having so many problems running with MySQL then why aren't you:
a) running SQLite
or
b) running latest nightlies that might address bugs with MySQL?I'm only having 1 problem with my install (not "so many")
I don't have time to doodle with nightlies that "might" address a problem. I've looked for changelogs for 6.0.3 or 6.1, but haven't found any.

JJZolx
2005-06-05, 21:20
I'm only having 1 problem with my install (not "so many")
I don't have time to doodle with nightlies that "might" address a problem. I've looked for changelogs for 6.0.3 or 6.1, but haven't found any.

I'd classify crashing once every 24 hours as a major problem. It may not be MySQL related, but if you've been running with MySQL for a while and haven't tried switching back to SQLite lately to see if it stabilizes, then you don't know. And even if the problem is NOT related to running MySQL, I'd think you'd be running with a more recent nightly just to see if the server were better behaved.

As to the 'net start' problem... I started running with MySQL a couple days ago, running the latest 6.1 nightlies on Windows XP Pro. So far it's been perfectly stable, but I'm also seeing similar problems when doing a 'net start' from a batch file. If I switch back to SQLite I don't have the problem, so I suspect it has something to do with MySQL, but as you've noted, there's no error message displayed or logged in Windows' event logs. What I've done is place the 'net start SlimServer' into a loop and keep trying until it starts. Usually it takes 3-5 tries.

Try this batch file:

@echo off
setlocal
::
:: Restart the SlimServer service. Try up to 10 times.
::
for /l %%i in (1,1,10) do (
:: Attempt to start the service
net start SlimServer
:: Pause 5 seconds before testing to see if the service started
ping -n 6 localhost > nul
:: Look for SlimServer in list of running services
net start | findstr /i /c:"SlimServer" > nul
:: Exit if found (success)
if %errorlevel% equ 0 goto :exitfor
)
:exitfor