-> version
VxWorks (for Company MMC-C PPC82XX F2000) version 5.5.2.
Kernel: WIND version 2.6.
Tornado version seems to be tornado2.2.2_PPC.
Please bear with me as VxWorks is completely new to me.
I have a module I've loaded with the 'ld < mymodule.out' and then run with a call to a method 'mymodule()'.
The issue is that I'd like to direct all output of that module (it spawns a task, which periodically printf's status info) to null, or the equivalent. It's not something that's going to be run on a customer machine, so a "one-off" approach is just fine.
Background: What I'm trying to do, is to automate a telnet session to the box, to load and run the module and then logoff when it's finished. Using wscript to automate the telnet and, other than it not logging off when the script completes, it's working great! As to why it fails to logoff when I launch the process, I'm unsure. If I remove that call, the telnet session opens up and closes just fine. Check it out:
:: :::::::::::::::::::::::::::::::::::::::::::::
:: http://www.antionline.com/showthread.php?264924-Scripting-windows-Telnet
:: temp_SendKeys.VBS will contain the "commands"
ECHO.set handler=WScript.CreateObject("WScript.Shell") >temp_SendKeys.VBS
ECHO.WScript.echo now() >>temp_SendKeys.VBS
ECHO.handler.run("Telnet") >>temp_SendKeys.VBS
ECHO.WScript.sleep 1500 >>temp_SendKeys.VBS
:: :::::::::::::::::::::::::::::::::::::::::::::
:: Open Connection To Telnet Host
ECHO.handler.SendKeys "open %Server% 2002~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 1500 >>temp_SendKeys.VBS
:: :::::::::::::::::::::::::::::::::::::::::::::
:: Send Login Name
ECHO.handler.SendKeys "system~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 1500 >>temp_SendKeys.VBS
:: Send Password
ECHO.handler.SendKeys "default~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 2000 >>temp_SendKeys.VBS
:: :::::::::::::::::::::::::::::::::::::::::::::
:: Send Stuff to be done
ECHO.handler.SendKeys "unld ""MyModule.out""~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 1000 >>temp_SendKeys.VBS
ECHO.handler.SendKeys "ld < MyModule.out~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 1000 >>temp_SendKeys.VBS
ECHO.handler.SendKeys "xdelete ""*data.txt""~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 3000 >>temp_SendKeys.VBS
ECHO.handler.SendKeys "myModule()~" >>temp_SendKeys.VBS
ECHO.WScript.echo "sleeping 1080000ms (18min)" >>temp_SendKeys.VBS
ECHO.WScript.sleep 1080000 >>temp_SendKeys.VBS
:: :::::::::::::::::::::::::::::::::::::::::::::
:: Logout
ECHO.handler.SendKeys "~~exit~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 1000 >>temp_SendKeys.VBS
ECHO.handler.SendKeys "quit~" >>temp_SendKeys.VBS
ECHO.WScript.sleep 1000 >>temp_SendKeys.VBS
ECHO.WScript.echo now() >>temp_SendKeys.VBS
:: Run the script
cscript//nologo temp_SendKeys.VBS
pause
If I comment out the last three lines in the "Send Stuff to be done" section, the script works fine. With those lines in place, the exit and quit commands seem not to be executed. I don't even see the text echoed into the telnet window. I've got some crazy theories as to why, but I'd like to start by hiding the output of the module and see if that fixes it.
Of course, I am always open to new ideas.
Update:
I added an option to my module to simply not print the status messages .. so I can toggle it by calling my method with a 0 or 1 as a parameter. This article helped me created a macro for the printing (though I used a static int that is set at runtime by the method's input var rather than another macro that must be set at compile time) so it's all pretty slick.
But, it didn't help.
Okay, so more testing revealed that about 5min seems to be about the max that wscript will sleep and still be able to send keystrokes to the intended app. Not sure why as no googling I've done has revealed any sort of limitation, but, there you go.
What I did learn though, is that I can simply exit after launching my module and wait in the calling batch file. So it waits and waits and waits some more (delay is purely arbitrary and chosen based on observation of past runs - poor, I know, but it's a dev script, run about 2x a year and this is good enough, heck, it's already a monumental improvement over the current process) and then carries on with the next task. Seems to do the trick!
Still puzzled though, why wscript is not working right after approximately 5 mins.