add file for borg backups

This commit is contained in:
Andreas Zweili 2016-12-17 16:10:38 +01:00
parent a8bbe92292
commit eb2f2d73f9
2 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,9 @@
import os
hostname = "google.com" #example
response = os.system("ping -c 1 " + hostname)
#and then check the response...
if response == 0:
print hostname, 'is up!'
else:
print hostname, 'is down!'

View File

@ -57,7 +57,8 @@ def mount_archive():
int_vars.mount_point = os.path.join('/tmp', archive_name)
if not os.path.exists(int_vars.mount_point):
os.makedirs(int_vars.mount_point)
p = subprocess.Popen(['borg', 'mount', '::' + archive_name, int_vars.mount_point])
p = subprocess.Popen(['borg', 'mount', '::' + archive_name,
int_vars.mount_point])
p.wait()
draw_screen(2, 2, "Archive mounted at " + int_vars.mount_point + "/.")
screen.addstr(3, 2, "The archive will remain mounted as long this programm "
@ -88,9 +89,11 @@ def delete_archive():
def create_archive():
archive_name = get_param("Please enter an archive name: ").decode('utf-8')
path_to_backup = get_param("Please enter the path to backup: ").decode('utf-8')
path_to_backup = get_param("Please enter the "
"path to backup: ").decode('utf-8')
draw_screen(2, 2, "Please wait while the backup gets created.")
p = subprocess.Popen(['borg', 'create', '::' + archive_name, path_to_backup])
p = subprocess.Popen(['borg', 'create', '::' + archive_name,
path_to_backup])
p.wait()
draw_screen(2, 2, "Archive of " + path_to_backup + " created.")
ncurses_pause(5)