D
durumdara
Hi !
I want to write a program that backup some databases in the night.
Pseudo like this:
try:
if cmd('net stop dbservice'):
s=c://backup'+str(time.time())+'.zip'
if cmd('zipit c:\\database '+s):
if cmd('map drive \\\\backupdrive\\c$ y -user BACKUP -pwd SECRET'):
if cmd('copy '+s+' y:\\'):
LogSucc()
finally:
cmd('net start dbservice')
I'm trying with os.system() commands.
But that is printing the result message to the screen, not to a tuple,
like commands.|getstatusoutput().
I need to store this message, because I want to log everything that this
program do/print; every of the messages.
So: how to I capture the screen, or how to I use
|commands.|getstatusoutput() to access the Windows batch/cmd commands,
and get their errors/statuses ?
Please help me !
Thanks for it: dd
|
I want to write a program that backup some databases in the night.
Pseudo like this:
try:
if cmd('net stop dbservice'):
s=c://backup'+str(time.time())+'.zip'
if cmd('zipit c:\\database '+s):
if cmd('map drive \\\\backupdrive\\c$ y -user BACKUP -pwd SECRET'):
if cmd('copy '+s+' y:\\'):
LogSucc()
finally:
cmd('net start dbservice')
I'm trying with os.system() commands.
But that is printing the result message to the screen, not to a tuple,
like commands.|getstatusoutput().
I need to store this message, because I want to log everything that this
program do/print; every of the messages.
So: how to I capture the screen, or how to I use
|commands.|getstatusoutput() to access the Windows batch/cmd commands,
and get their errors/statuses ?
Please help me !
Thanks for it: dd
|