Auto backup something with python in freebsd system
This program just to backup all apache22 in the freebsd system to a .tar.gz file with date.source code:#!/usr/bin/env python import osimport datetime today= datetime.date.today().isoformat()cmdtar = "
·
This program just to backup all apache22 in the freebsd system to a .tar.gz file with date.
source code:
#!/usr/bin/env python
import os
import datetime
today= datetime.date.today().isoformat()
cmdtar = "tar -C /usr/local/www/ -cvf /usr/home/sino/source_bakup/apache22_"+today+".tar apache22"
cmdgz = "gzip /usr/home/sino/source_bakup/apache22_"+today+".tar"
print cmdtar
os.system(cmdtar)
print cmdgz
os.system(cmdgz)
source code:
#!/usr/bin/env python
import os
import datetime
today= datetime.date.today().isoformat()
cmdtar = "tar -C /usr/local/www/ -cvf /usr/home/sino/source_bakup/apache22_"+today+".tar apache22"
cmdgz = "gzip /usr/home/sino/source_bakup/apache22_"+today+".tar"
print cmdtar
os.system(cmdtar)
print cmdgz
os.system(cmdgz)
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献4条内容
所有评论(0)