Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-24-2014, 11:34 PM
Junho Junho is offline
Registered User
 
Join Date: Oct 2013
Posts: 4
I want to save to file.

this is my script.

When I finish this script, I want to save output to local file c:\Date-time.
help me.. ^^;

Thank you very much.


# $language = "python"
# $interface = "1.0"

# This automatically generated script may need to be
# edited in order to work correctly.

#------------------------------------------------------------------------#
def do1():
crt.Screen.Send("cat /proc/sys/fs/file-nr" + chr(13))

def do2():
crt.Screen.Send("dpkg -l | grep lvm" + chr(13))

def do3():
crt.Screen.Send("echo" + chr(13))
#------------------------------------------------------------------------$
def dooo1():
#Command Detail
crt.Screen.WaitForString("test@test")
do1()
crt.Screen.WaitForString("test@test")

def dooo2():
#Command Detail
do2()
crt.Screen.WaitForString("test@test")


def dooLast():
#Command Detail
do3()
crt.Screen.WaitForString("test@test")
crt.Screen.Send("exit" + chr(13))
crt.Screen.WaitForString("adminuser@domain.com:~$")

def doall():
#Command Detail
dooo1()
dooo2()
dooLast()



def Main():
crt.Screen.Send("ssh -p 22 test@test1a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test2a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test3a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test4a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test5a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test6a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test7a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test8a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test9a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test10a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test11a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test12a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test13a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test14a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test15a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test16a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test17a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test18a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test19a.p19" + chr(13))
doall()
crt.Screen.Send("ssh -p 2202 test@test20a.p19" + chr(13))
doall()


Main()
Reply With Quote
  #2  
Old 08-25-2014, 09:11 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Junho,

You can find Python documentation on writing files at the following location:
https://docs.python.org/2/tutorial/inputoutput.html
Section 7.2 is specific to reading and writing files.

You can find Python documentation about working with the system time and date at the following location:
https://docs.python.org/2/library/datetime.html
We also have an example script that uses the information in the referenced Python documentation at the following location:
https://forums.vandyke.com/showthrea...7294#post37294
In the example script, the GetSafeFilename() function shows how to use the Python datetime module.

Does this help you finish writing your script?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 03:21 PM.