LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically shut-off and restart LabView program, and Auto-run at PC restart?

Hello,

 

I am trying to periodically, say every two weeks, to close and restart a LabView program (stand-alone executable) that is running on a PC. That PC has only the Labview run-time engine installed from the LV program installer.  I knew I can have Windows to do a "Scheduled task" to turn off and on my program, but I am trying to see if there is any alternatives?

 

Second question is, when creating the LabView installer (so others can just do regular installation to run the executable), can I somehow include a function/option such that the installer will create a short-cut in the Windows Startup folder (in Windows XP, Start -> Program -> Startup).  What I want is that my LV program can start running automatically every time if the computer get restarted or power-cycled.

 

Thanks for your help!

 

Rgds,

 

Harry

0 Kudos
Message 1 of 17
(7,506 Views)

See this KnowledgeBase article to learn how to run a LabVIEW application as a service under Windows.

 

http://digital.ni.com/public.nsf/websearch/21BA0F671A63A60386256CB4004DF99B?OpenDocument

 

You could also buy a product called FireDaemon Pro.

 

My company hase used this with good success. It includes many options including scheduled restart.

 

http://www.firedaemon.com/firedaemon-pro.php?id=profeatures

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 2 of 17
(7,505 Views)

You can shutdown and restart Windows from the command line so that means you could also use the LabView Systemexec VI to do the same thing.

 

The comand is "shutdown"

 

The options available for shutdown are:

No arguments : Display this message (same as -?)
-i : Display GUI interface, must be the first option
-l : Log off (cannot be used with -m option)
-s : Shutdown the computer
-r : Shutdown and restart the computer
-a : Abort a system shutdown
-m \\computername : Remote computer to shutdown/restart/abort
-t xx : Set timeout for shutdown to xx seconds
-c “comment” : Shutdown comment (maximum of 127 characters)
-f : Forces running applications to close without warning
-d [u][p]:xx:yy : The reason code for the shutdown

 

To start a LabView program on boot simply put the LabView exe in the startup group.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 17
(7,485 Views)

You can use this to reboot.

0 Kudos
Message 4 of 17
(7,475 Views)

@paul_a_cardinale wrote:

You can use this to reboot.


Which uses the Systemexec VI to run the shutdown command line...Smiley Wink

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 17
(7,471 Views)

Thanks! But what about restart the program? I saw only Exit...

 

Harry

0 Kudos
Message 6 of 17
(7,469 Views)

So I guess the Systemexec VI is the right way to do this. How can I put the time control on this auto program reboot? Say have it reboot every 30 mintues?

 

Thanks

 

Harry

0 Kudos
Message 7 of 17
(7,468 Views)

Have you tried putting the LabView exe or a shortcut to it in the Startup Group?

 

For timing you will have to put a timer in your LabView program if you want LabView to reboot it at speicified times or  regular intervals

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 17
(7,466 Views)

RTSLVU,

 

Thanks for your reply. Yes I know I can put a shortcut in Startup folder MANUALLY. I just wonder if there is an option when creating the LV excutable or Installer so that a short-cut will be created in Startup AUTOMATICALLY. Lots of softwares do that so I wonder if LV can do that too.

 

As for the System Exec.vi, it seems Exit or Shut down a LV program is easy, but how about restart the same program AFTER the Exit action? I don't want to reboot the computer or Windows every time. I just need the LV program reboot itself...

 

Thanks!

 

Rgds,

 

Harry

0 Kudos
Message 9 of 17
(7,452 Views)

Look at the "Destinations" in your  vi's build specifications. I think you will find your answer there.

 

I have to ask why you need you LabView program to restart it's self? 

 

Do you have some sort of memry leak or something that could be better fixed in code then exiting and restarting the program?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 17
(7,449 Views)