-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbackup.py
39 lines (37 loc) · 1.31 KB
/
backup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import time
import os
from aws_backup import *
from main_window import *
import getpass
USER_NAME = getpass.getuser()
def add_to_startup():
file_path = os.path.dirname(os.path.realpath(__file__))
bat_path = r'C:\Users\%s\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup' % USER_NAME
with open(bat_path + '\\' + "BackMeUpOnStartup.bat", "w+") as bat_file:
bat_file.write('cd '+file_path+'\n')
bat_file.write('python backup.py')
if __name__ == '__main__':
if not (os.path.exists('user')):
add_to_startup()
while(True):
app = QApplication(sys.argv)
ex = Backup()
app.exec_()
var_list = ex.getpass()
if(len(var_list)==4):
add_update_new_device(var_list)
while(True):
try:
update_device()
time.sleep(20)
except:
print('Unable to connect to the Internet. Retrying...')
time.sleep(20)
else:
while(True):
try:
update_device()
time.sleep(20)
except:
print('Unable to connect to the Internet. Retrying...')
time.sleep(20)