add file for borg backups
This commit is contained in:
parent
a8bbe92292
commit
eb2f2d73f9
9
borg_interface/connectivity.py
Normal file
9
borg_interface/connectivity.py
Normal 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!'
|
|
@ -57,7 +57,8 @@ def mount_archive():
|
||||||
int_vars.mount_point = os.path.join('/tmp', archive_name)
|
int_vars.mount_point = os.path.join('/tmp', archive_name)
|
||||||
if not os.path.exists(int_vars.mount_point):
|
if not os.path.exists(int_vars.mount_point):
|
||||||
os.makedirs(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()
|
p.wait()
|
||||||
draw_screen(2, 2, "Archive mounted at " + int_vars.mount_point + "/.")
|
draw_screen(2, 2, "Archive mounted at " + int_vars.mount_point + "/.")
|
||||||
screen.addstr(3, 2, "The archive will remain mounted as long this programm "
|
screen.addstr(3, 2, "The archive will remain mounted as long this programm "
|
||||||
|
@ -88,9 +89,11 @@ def delete_archive():
|
||||||
|
|
||||||
def create_archive():
|
def create_archive():
|
||||||
archive_name = get_param("Please enter an archive name: ").decode('utf-8')
|
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.")
|
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()
|
p.wait()
|
||||||
draw_screen(2, 2, "Archive of " + path_to_backup + " created.")
|
draw_screen(2, 2, "Archive of " + path_to_backup + " created.")
|
||||||
ncurses_pause(5)
|
ncurses_pause(5)
|
||||||
|
|
Reference in New Issue
Block a user