• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Batch file to start and stop services

Guest
Dec 08, 2006 Dec 08, 2006

Copy link to clipboard

Copied

I've setup a CF Probe on my Development Server to ensure my CF Production server is up and running (services = Apache and CF Application Server). It checks the PROD login page and if it times out in 30 sec the probe fails. I understand I can execute a file (batch file with net start and net stop) but the problem is I need to have the probe somehow point to the .bat file on the PROD server and not on the local machine. How can I remotely access this batch file and execute it? I don't know how to point to the file on the other server... can anyone help?
TOPICS
Advanced techniques

Views

898

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 08, 2006 Dec 08, 2006

Copy link to clipboard

Copied

I would presume you would use a UNC path: \\server\directory\file.

Of course any CF running this code would have to running as a user that
has permissions to read this path.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 08, 2006 Dec 08, 2006

Copy link to clipboard

Copied

That will still execute on the development server, regardless of the file path. A simple batch is not your answer. Have a look at psservice.exe from SysInternals.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 11, 2006 Dec 11, 2006

Copy link to clipboard

Copied

Hi Ken,
You had pointed me in the right direction regarding the psstools in order to create a batch file that can remotely start and stop services.

i used the psexec command and am able to successfully restart the services needed remotely... however when i pick the file in the coldfusion administrator (in the probes section) how to i point to the batch file to run? it seems like the probe is not running the script like i want... the file is located on the c:\ so i entered c:\test2.bat...

Thanks,
Matt

***********

Matt,
You should review the online help in the cfadmin for probes and the links it points you to in the developer's guide. Basically you need to define a new probe in the cfadmin by clicking the "Define New Probe" button. One of the probe's attributes will be what action. Define the action as a program and point it at a batch file running psexec. You will probably need to run CFMX as a specific user and not as localsystem, which is the default.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 12, 2006 Dec 12, 2006

Copy link to clipboard

Copied

LATEST
ken,
here is what i am doing to test it. i created a file called test2.bat which contains the command "del test.txt" (test.txt contains 3 letters abc). i then run a file called test3.cfm with the following code:

<cfexecute name="d:\test2.bat">
</cfexecute>

then when i look on the d: drive test.txt does not get deleted. i get no coldfusion errors so it appears the bat file runs. when i click and run the bat file manually it does what its supposed to and deletes test.txt file (which is within the same directory as the bat file). so the problem is that the bat file is not doing the commands its supposed to when coldfusion executes it... what do you suppose is wrong? i also followed the link in your previous help and setup a coldfusion user the way it told me to.

thx,
-matt

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation