· 7 years ago · Mar 12, 2018, 12:40 PM
1#!/usr/bin/python
2import os
3
4from datetime import date
5
6pem_file = '/mnt/pk-something.pem'
7cert_file = '/mnt/cert-something.pem'
8user_id = 'secret'
9platform = 'i386'
10bucket = 'ebitemp-bak'
11location = 'EU' # EU or US
12
13access_key = 'secret'
14secret_key = 'secret'
15ec2_path = '/usr/bin/' #use trailing slash
16
17# DO NOT EDIT BELOW THIS
18
19days = ('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'sturday', 'sunday')
20manifest = days[date.today().weekday()]
21
22step_1 = 'rm -f /mnt/%s*' % (manifest,)
23step_2 = '%sec2-bundle-vol -p %s -d /mnt -k %s -c %s -u %s -r %s' % (ec2_path, manifest, pem_file, cert_file, user_id, platform)
24step_3 = '%sec2-upload-bundle -b %s -m /mnt/%s.manifest.xml -a %s -s %s --location %s' % (ec2_path, bucket, manifest, access_key, secret_key, location)
25
26print step_1
27os.system(step_1)
28print step_2
29os.system(step_2)
30print step_3
31os.system(step_3)