auto restart

mkramer777
mkramer777 used Ask the Experts™
on
I have an executable program that stops every once in awhile.  Then I have to double click it to start again.  Is there a way to auto restart this program?  It is on a windows 2012 server.  It does not have a service to start it.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
How quickly do you notice that it has stopped? Can you start it using a scheduled task?

Author

Commented:
How would a scheduled task know to run the task when the program has stopped?
Your scheduled task could be to run a batch file which first of all checks to see if the executable is already running, and if not, starts it...

http://stackoverflow.com/questions/162291/how-to-check-if-a-process-is-running-via-a-batch-script

Set the task to run as often as you want / need
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Author

Commented:
Without reading everything on the link, what part can I copy and paste as a batch file that will start the executable if it sees it is not started?
OK. Supposing you wanted to check for Outlook running, and if not then you wanted to start it. This is a batch file that I have created (and just tested):-

@echo off
tasklist /FI "IMAGENAME eq outlook.exe" 2>NUL | find /I /N "outlook.exe">NUL
if "%ERRORLEVEL%"=="0" goto programisrunning
start "" "C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"
exit
:programisrunning
echo Program Is Running

Open in new window


Save this code as something.cmd and then create a scheduled task to run that cmd file as often as you need.

Author

Commented:
I got it to work.  How would I set a schedule to run the task every hour?  Do I need to create a task for each hour?
No - in the scheduled task trigger, you can specify that the task repeats every 1 hours

Author

Commented:
Worked perfectly.  Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial