예제 #1
0
파일: sbc.py 프로젝트: archcidburnziso/sb
 def ftp_backup(self, bk_type):
     if self.bk_type == "--fbz2":
         self.bk_file = sys.argv[sys.argv.index("--fbz2")+1]
         self.bk_arch = 'bz2'
     elif self.bk_type == "-fb":
         self.bk_file = sys.argv[sys.argv.index("-fb")+1]
         self.bk_arch = 'bz2'
     elif self.bk_type == "--fgz":
         self.bk_file = sys.argv[sys.argv.index("--fgz")+1]
         self.bk_arch = 'gz'
     elif self.bk_type == "-fg":
         self.bk_file = sys.argv[sys.argv.index("-fg")+1]
         self.bk_arch = 'gz'
     elif self.bk_type == "--fzip":
         self.bk_file = sys.argv[sys.argv.index("--fzip")+1]
         self.bk_arch = 'zip'
     elif self.bk_type == "-fz":
         self.bk_file = sys.argv[sys.argv.index("-fz")+1]
         self.bk_arch = 'zip'
     self.dest_dir = '/tmp/'
     self.host = 'asd'
     self.port = 'asd'
     self.user = '******'
     self.directory = 'asd'
     bk_create = libcompress.compress()
     print(self.color('<blue>I: Backing-up with %s format...</blue>' % (self.bk_arch)))
     bk_create.backup(self.bk_file, self.dest_dir, self.bk_arch)
     print(self.color('<blue>I: Uploading %s on %s:$s as %s in %s...</blue>' % (bk_create.archname, self.host, self.port, self.user, self.directory)))
     bk_ftp = libftp.libftp()
     bk_ftp.upload(self.bk_arch_name, self.host, self.port, self.user, self.directory)
     print(self.color('<green>I: Done! Uploaded your backup as</green> <cyan>%s</cyan> <green>on</green> <cyan>%s</cyan><green>!</green>' % (bk_create.archname, self.host)))
예제 #2
0
파일: sb.py 프로젝트: archcidburnziso/sb
 def start_bk(self, obj):
     self.bkback4_btn.set_sensitive(False)
     self.bkstart_btn.set_sensitive(False)
     self.archformat = self.archtype
     if self.rb_localdir.get_active() == True:
         self.localdest = self.fc_localdir.get_uri()
         self.param, self.localdest = self.localdest.split("file://", 1)
         bk_local = libcompress.compress()
         bk_local.backup(self.to_backup, self.localdest, self.archtype)
     elif self.rb_ftpdir.get_active() == True:
         self.ftpsrv = self.ftpsrv_entry.get_text()
         if self.ftport_entry.get_text() != "":
             self.ftport = self.ftport_entry.get_text()
         else:
             self.ftport = "80"
         self.ftpdir = self.ftpdir_entry.get_text()
         self.ftpuser = self.ftpuser_entry.get_text()
         self.ftpass = self.ftpass_entry.get_text()
         bk_ftp = libftp.libftp()
         bk_ftp.upload(self.bk_arch_name, self.host, self.port, self.user, self.directory)
         self.localdest = "ftp://%s@%s:%s/%s" % (self.ftpuser, self.ftpsrv, self.ftport, self.ftpdir)
     self.backuprogress.set_fraction(1.00)
     self.bkstart_btn.set_label("Finish!")
     self.lb_status.set_label("Finished! Backup saved in: %s" % (self.localdest))
     self.bkstart_btn.disconnect(self.bkstart_btn.connect("clicked", self.start_bk))
     self.bkstart_btn.set_sensitive(True)
     self.bkstart_btn.connect("clicked", self.quit)
예제 #3
0
파일: sbc.py 프로젝트: archcidburnziso/sb
 def backup(self, bk_format):
     if bk_format == "--bz2":
         self.bk_file = sys.argv[sys.argv.index("--bz2")+1]
         if sys.argv[sys.argv.index("--bz2")+2] != '':
             self.dest_dir = sys.argv[sys.argv.index("--bz2")+2]
         else:
             self.dest_dir = os.getcwd()
         bk_archtype = 'bz2'
     elif bk_format == "-b":
         self.bk_file = sys.argv[sys.argv.index("-b")+1]
         if sys.argv[sys.argv.index("-b")+2] != '':
             self.dest_dir = sys.argv[sys.argv.index("-b")+2]
         else:
             self.dest_dir = os.getcwd()
         bk_archtype = 'bz2'
     elif bk_format == "--gz":
         self.bk_file = sys.argv[sys.argv.index("--gz")+1]
         if sys.argv[sys.argv.index("--gz")+2] != '':
             self.dest_dir = sys.argv[sys.argv.index("--gz")+2]
         else:
             self.dest_dir = os.getcwd()
         bk_archtype = 'gz'
     elif bk_format == "-g":
         self.bk_file = sys.argv[sys.argv.index("-g")+1]
         if sys.argv[sys.argv.index("-g")+2] != '':
             self.dest_dir = sys.argv[sys.argv.index("-g")+2]
         else:
             self.dest_dir = os.getcwd()
         bk_archtype = 'gz'
     elif bk_format == "--zip":
         self.bk_file = sys.argv[sys.argv.index("--zip")+1]
         if sys.argv[sys.argv.index("--zip")+2] != '':
             self.dest_dir = sys.argv[sys.argv.index("--zip")+2]
         else:
             self.dest_dir = os.getcwd()
         bk_archtype = 'zip'
     elif bk_format == "-z":
         self.bk_file = sys.argv[sys.argv.index("-z")+1]
         if sys.argv[sys.argv.index("--bz2")+2] != '':
             self.dest_dir = sys.argv[sys.argv.index("-z")+2]
         else:
             self.dest_dir = os.getcwd()
         bk_archtype = 'zip'
     print(self.color('<blue>I: Backing-up with %s format...</blue>' % (bk_archtype)))
     bk_create = libcompress.compress()
     bk_create.backup(self.bk_file, self.dest_dir, bk_archtype)
     print(self.color('<green>I: Done! You can find your backup in </green> <cyan>%s</cyan><green>!</green>' % (bk_create.dirs)))