05-18-2012 08:58 AM
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
05-18-2012 09:16 AM
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
05-18-2012 10:09 AM - edited 05-18-2012 10:11 AM
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.
05-18-2012 11:07 AM
You can use this to reboot.
05-18-2012 11:12 AM
@paul_a_cardinale wrote:
You can use this to reboot.
Which uses the Systemexec VI to run the shutdown command line...
05-18-2012 11:13 AM
Thanks! But what about restart the program? I saw only Exit...
Harry
05-18-2012 11:16 AM
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
05-18-2012 11:19 AM - edited 05-18-2012 11:20 AM
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
05-18-2012 12:58 PM
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
05-18-2012 01:01 PM - edited 05-18-2012 01:03 PM
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?