Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

commandline interface for coldfusion services?

Status
Not open for further replies.

brianpercival

Programmer
Jun 13, 2005
63
US

Hi all,

I have an odd problem. I run a scheduled page which reads records from a visual foxpro database table (using odbc dsn) and populates sqlserver table. This page runs every 20 min to keep the sqlserver db table up to date.

Now, every now and then, the reading from the foxpro db fails due to unreliable odbc vfp driver.

I found if I restart the coldfusion odbc server and agent, it starts working fine (some kind of file locking takes place on the foxpro database somehow and when I restart the cf odbc services it works fine.

I have my queries in a cftry, so I know in cfcatch when something fails.

In this cfcatch, I now want to include the code which will basically restart the odbc services. I rightclick->properties on the above services, and know which .exe s are being run. But how do I restart them? I know I have to use cfexecute but what exactly is the command line option to stop/start????

Can someone please help??


regards,
Brian
 
Your best bet would be to create a batch file and put the commands in there. (It's my preferred method anyway)

To restart the service you need to stop it then start it.

To stop a service you need to use:

NET STOP SERVICE_NAME

To start the service you need to use:

NET START SERVICE_NAME

So basically you just need to create a file called restart.bat and in it place the following:

Code:
NET STOP SERVICE_NAME
NET START SERVICE_NAME

You will need to alter the service name to reflect the actual service though. In your script you would then use CFEXECUTE to run the batch file.

Hope this helps

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Thanks wullie,

the NET STOP , NET START are the commands I was looking for..

regards,
brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top