Exemple #1
0
def backupShare(share, media, login):
    """
    Launch as a background process the backup of a share
    """
    r = AF().log(PLUGIN_NAME, AA.SAMBA_BACKUP_SHARE, [(share, AT.SHARE), (login, AT.USER)], media)
    config = BasePluginConfig("base")
    cmd = os.path.join(config.backuptools, "backup.sh")
    if share == "homes":
        #  FIXME: Maybe we should have a configuration directive to tell that
        #  all users home are stored into /home
        savedir = "/home/"
    else:
        smbObj = SambaConf(SambaConfig("samba").samba_conf_file)
        savedir = smbObj.getContent(share, "path")
    # Run backup process in background
    shlaunchBackground(
        cmd
        + " "
        + share
        + " "
        + savedir
        + " "
        + config.backupdir
        + " "
        + login
        + " "
        + media
        + " "
        + config.backuptools,
        "backup share " + share,
        progressBackup,
    )
    r.commit()
    return os.path.join(config.backupdir, "%s-%s-%s" % (login, share, strftime("%Y%m%d")))
Exemple #2
0
def reloadSamba():
    r = AF().log(PLUGIN_NAME, AA.SAMBA_RELOAD_SAMBA)
    shlaunchBackground(SambaConfig("samba").samba_init_script + " reload")
    r.commit()
    return 0
Exemple #3
0
def restartSamba():
    r = AF().log(PLUGIN_NAME, AA.SAMBA_RESTART_SAMBA)
    shlaunchBackground(SambaConfig("samba").samba_init_script + " restart")
    r.commit()
    return 0
Exemple #4
0
def reloadSamba():
    r = AF().log(PLUGIN_NAME, AA.SAMBA4_RELOAD_SAMBA)
    shlaunchBackground('systemctl reload samba.service')
    r.commit()
    return 0
Exemple #5
0
def restartSamba():
    r = AF().log(PLUGIN_NAME, AA.SAMBA4_RESTART_SAMBA)
    shlaunchBackground('systemctl restart samba.service')
    r.commit()
    return 0