- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathback_project.py
More file actions
Latest commit
19 lines (18 loc) · 612 Bytes
/
Copy pathback_project.py
File metadata and controls
19 lines (18 loc) · 612 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python
importos
importtime
os.chdir('/project/')
source_list= ['/project/app','/project/rqb','/project/rqt']
target_dir='/backup/'
today=time.strftime('%Y%m%d')
ifnotos.path.exists(target_dir+today):
os.mkdir(target_dir+today)
print"Successful created directory",target_dir+today
forsourceinsource_list:
target=target_dir+today+os.sep+source[9:] +'.tar.gz'
tar_command="tar zcvf %s %s"% (target, source[9:])
ifos.system(tar_command) ==0:
print'Successful backup to',target
time.sleep(3)
else:
print'Backup FALLED'