我正在尝试自动化数据库转储,它就像在脚本中一样工作
sched = Scheduler()
@sched.cron_schedule(day_of_week='mon-fri', hour=13)
def dump():
'''Dumps database with predefined data'''
user = 'root'
password = 'root'
host = 'localhost'
database = 'root_db'
filestamp = time.strftime('%Y-%m-%d-%I:%M')
os.popen("mysqldump -u %s -p%s -h %s -e --opt -c %s | gzip -c > %s.gz" % (user, password, host, database, database + "_" + filestamp))
print "\n-- please have a the dump file in " + database + "_" + filestamp + ".gz --"
if __name__ == "__main__":
sched.start()
while True:
pass
此外,我在计算机上有 4 个没有超线程的内核,并且我已经部署了 4 个 Tornado 实例。我的问题是,如果我启动上面的脚本,它会占用一个处理器吗?