Hello, I am trying to run this script unattended, it works fine when logged in but not when not logged in. I know it has something to do with the console window and have also tried "ControlSend" commands but nothing works. I have run scripts like this before using batch files and those work, the thing that is different for me this time is console window is taking commands from the script.
The script runs a batch file which sends snmpget queries and populates a set of files, and then makes an insert statement into a database..
Thanks in advance for any help.
$i=0
While $i<10
$i=1
run("log.bat")
Sleep (5000)
$m1log1= FileRead ("m1log1.txt")
$m1log2= FileRead ("m1log2.txt")
$m1log3= FileRead ("m1log3.txt")
$m1log4= FileRead ("m1log4.txt")
$m1log5= FileRead ("m1log5.txt")
$m1log6= FileRead ("m1log6.txt")
$m2log1= FileRead ("m2log1.txt")
$m2log2= FileRead ("m2log2.txt")
$m2log3= FileRead ("m2log3.txt")
$m2log4= FileRead ("m2log4.txt")
$m2log5= FileRead ("m2log5.txt")
$m2log6= FileRead ("m2log6.txt")
;enter database
Run("db.bat")
Sleep (500)
Send ("{ENTER}")
sleep (15000)
;insert for m1
Send ("insert into LOG (datetime,modem,log1,log2,log3,log4,log5,log6) values (now(),'Det1&2','"&($m1log1)&"','"&($m1log2)&"','"&($m1log3)&"','"&($m1log4)&"','"&($m1log5)&"','"&($m1log6)&"');")
Send ("{ENTER}")
sleep (3000)
;insert for m2
Send ("insert into LOG (datetime,modem,log1,log2,log3,log4,log5,log6) values (now(),'Det3','"&($m2log1)&"','"&($m2log2)&"','"&($m2log3)&"','"&($m2log4)&"','"&($m2log5)&"','"&($m2log6)&"');")
Send ("{ENTER}")
sleep (3000)
;exit database
;Send ("exit")
;Send ("{ENTER}")
Winclose ("D:\nrl\cmd.exe")
sleep (60000)
wend
Note: the db.bat batch file logs into the database:
; mysql.exe -h 10.10.10.10 -u user -ppassword -D database
The script runs a batch file which sends snmpget queries and populates a set of files, and then makes an insert statement into a database..
Thanks in advance for any help.
$i=0
While $i<10
$i=1
run("log.bat")
Sleep (5000)
$m1log1= FileRead ("m1log1.txt")
$m1log2= FileRead ("m1log2.txt")
$m1log3= FileRead ("m1log3.txt")
$m1log4= FileRead ("m1log4.txt")
$m1log5= FileRead ("m1log5.txt")
$m1log6= FileRead ("m1log6.txt")
$m2log1= FileRead ("m2log1.txt")
$m2log2= FileRead ("m2log2.txt")
$m2log3= FileRead ("m2log3.txt")
$m2log4= FileRead ("m2log4.txt")
$m2log5= FileRead ("m2log5.txt")
$m2log6= FileRead ("m2log6.txt")
;enter database
Run("db.bat")
Sleep (500)
Send ("{ENTER}")
sleep (15000)
;insert for m1
Send ("insert into LOG (datetime,modem,log1,log2,log3,log4,log5,log6) values (now(),'Det1&2','"&($m1log1)&"','"&($m1log2)&"','"&($m1log3)&"','"&($m1log4)&"','"&($m1log5)&"','"&($m1log6)&"');")
Send ("{ENTER}")
sleep (3000)
;insert for m2
Send ("insert into LOG (datetime,modem,log1,log2,log3,log4,log5,log6) values (now(),'Det3','"&($m2log1)&"','"&($m2log2)&"','"&($m2log3)&"','"&($m2log4)&"','"&($m2log5)&"','"&($m2log6)&"');")
Send ("{ENTER}")
sleep (3000)
;exit database
;Send ("exit")
;Send ("{ENTER}")
Winclose ("D:\nrl\cmd.exe")
sleep (60000)
wend
Note: the db.bat batch file logs into the database:
; mysql.exe -h 10.10.10.10 -u user -ppassword -D database