Create a file on services start up

Hi All,

I have a requirement where i need to start some services when the server reboots, for this i have a .bat file that starts the services and i placed this in the startup folder. My other need is i want to create a simple file (any type) once the services are started . The reason is i have to start services on a different server and this task should be started once all the services are started on the first server. I'm thinking once the file is created i have my script on the second server to look for this file and if exists start the services on the second server. 

On the first server i have the script to start the services as

cmd /c F:\Oracle\Middleware\user_projects\epmsystem1\bin\start.bat

To this i added fsutil file createnew EmptyFile.txt 0, but the create file part is not working. Any ideas please?

Thanks

August 20th, 2015 12:52pm

Hi,

Sorry for the delay in reply.

As the purpose is to "generate something as a trigger to start services on different server", I think it could be done with several workarounds:

1. Check if start the service locally will trigger any event - use the event as ID as a trigger and run a command locally to start a service on other computers such as using SC or PSEXEC:

sc \\server start ServiceName

psexec \\server -u username -p password net start <Service>

2. Also you can add a script just like your description - to create a file, open a port to deliver a message to another service (for logging an event log) and use it as a trigger. PSEXEC should also help on this purpose.

Meanwhile if you have to create a file, test if run "fsutil file createnew EmptyFile.txt 0" directly will create a file before adding it into a script.


Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 3:34am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics