From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Restart computer when program not running

Solved!
Go to solution

Hello,

 

I am using Labview 2011 and 2014.

I have set windows to launch my program when the computer is turned on. The VI is set so that the program runs when launched. Things have been working fine for several ON/OFF sequences of the computer. But last time when getting back to the screen I realised that the program was not running (just like if it was waiting for the user to press the white arrow). I pressed the white arrow and the program worked fine. I started up the computer and everything worked too. this program is suppose to run quite far away from work where I don't have access to the computer (not able to check if things are ok..)

 

My question is : how could I make the computer make a Stop and Start sequence if my program stops or isn't running?

 

Thanks.

 

User

0 Kudos
Message 1 of 8
(3,615 Views)
Solution
Accepted by topic author user_79

Since it sounds like your application just stopped normally,  I would add in a System Exec call to reset your computer.  The command you want to use to reboot the computer is

shutdown /r /t 0

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 8
(3,568 Views)

Dear User_1979,

 

In a similar situation, in a remote place, I used an electrical digital programmer and done the following sequence:

  • 5 minutes before the time I programmed to switch off the electrical power I close the program and shutdown the PC;
  • The electrical digital programmer switched off the power, wait 1 minute and switch on again;
  • The computer is programmed to switch on when the electrical power is switch on;
  • The computer starts and the program starts.

With this sequence you lose 10 minutes per day but you guarantee that in the worst case, unless the computer burns, you only have one day without contact with the equipment.

 

Sérgio

0 Kudos
Message 3 of 8
(3,532 Views)

Thanks Crossrulz and Sergio for your snwers.

 

Sergio, I will keep in mind your solution.

 

Crossrultz, your solution works fine on my cpumtor where I have Seven and Labview 2014 installed. I tried it on the computer that I posted this question for and the problem is tkat windows asks me to confirm (my clicking on "ok") the closing of the windows tha are open. DO you know how I could avoid that? (the computer just shuts off on tis own wuithout antybody to confirm by clicking)

 

User

0 Kudos
Message 4 of 8
(3,473 Views)

PS : the second computer is using XP 2002 SP3 and labview 2011

0 Kudos
Message 5 of 8
(3,469 Views)

Configure the application to run as a service - if the process stops running it will restart it. There are also programs that can do this for you (monitor the exe and if it leaves memory it will restart it).

 

You could even write a little monitoring application which runs as a service and communicates with your application and if it doesn't get a response it will kill/restart it.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 8
(3,456 Views)

User79 escreveu:

Thanks Crossrulz and Sergio for your snwers.

 

Sergio, I will keep in mind your solution.

 

Crossrultz, your solution works fine on my cpumtor where I have Seven and Labview 2014 installed. I tried it on the computer that I posted this question for and the problem is tkat windows asks me to confirm (my clicking on "ok") the closing of the windows tha are open. DO you know how I could avoid that? (the computer just shuts off on tis own wuithout antybody to confirm by clicking)

 

User


Maybe you can try the shutdown command with the /f option added to Crossrulz solution, resulting in:

shutdown /r /t 0 /f

 

Sérgio

Message 7 of 8
(3,449 Views)

Hi Sam and Sergio,

 

Thanks for your answer Sam but I was looking for something more direct and simple.

Sergio, adding the f closes everyhting. Thanks a lot it works fine now. 

 

best regards,

 

user

0 Kudos
Message 8 of 8
(3,407 Views)