config module

Configuration logic.

This module and its Config class contain the application logic handling the configuration of Back In Time. The handling of the configuration file itself is separated in the module configfile.

Development notes:

Some of the methods have code comments starting with #? ` instead of `# `. These special comments are used to generate the manpage `backintime-config. The script create-manpage-backintime-config.py parses this module for that.

class config.Config(config_path=None, data_path=None)[source]

Bases: ConfigFileWithProfiles

APP_NAME = 'Back In Time'
AT_EVERY_BOOT = 1
CONFIG_VERSION = 6

Latest or highest possible version of Back in Time’s config file.

COPYRIGHT = 'Copyright (C) 2008-2024 Oprea Dan, Bart de Koning, Richard Bailey, Germar Reitze, Christian Buhtz, Michael Büker, Jürgen Altfeld et al.'
CUSTOM_HOUR = 19
DAY = 20
DEFAULT_EXCLUDE = ['.gvfs', '.cache/*', '.thumbnails*', '.local/share/[Tt]rash*', '*.backup*', '*~', '.dropbox*', '/proc/*', '/sys/*', '/dev/*', '/run/*', '/etc/mtab', '/var/cache/apt/archives/*.deb', 'lost+found/*', '/tmp/*', '/var/tmp/*', '/var/backups/*', '.Private', '/swapfile', 'SingletonLock', 'SingletonCookie', 'lock']
DEFAULT_REDIRECT_STDERR_IN_CRON = False
DEFAULT_REDIRECT_STDOUT_IN_CRON = True
DEFAULT_RUN_IONICE_FROM_CRON = True
DEFAULT_RUN_IONICE_FROM_USER = False
DEFAULT_RUN_IONICE_ON_REMOTE = False
DEFAULT_RUN_NICE_FROM_CRON = True
DEFAULT_RUN_NICE_ON_REMOTE = False
DEFAULT_RUN_NOCACHE_ON_LOCAL = False
DEFAULT_RUN_NOCACHE_ON_REMOTE = False
DEFAULT_SSH_PREFIX = 'PATH=/opt/bin:/opt/sbin:\\$PATH'
DISK_UNIT_GB = 20
DISK_UNIT_MB = 10
ENCODE = <encfstools.Bounce object>
HOUR = 10
MONTH = 40
NONE = 0
PLUGIN_MANAGER = <pluginmanager.PluginManager object>
REPEATEDLY = 25
SYSTEM_ENTRY_MESSAGE = '#Back In Time system entry, this will be edited by the gui:'

The string is used in crontab file to mark entries as owned by Back In Time. WARNING: Don’t modify that string in code because it is used as match target while parsing the crontab file.

UDEV = 27
WEEK = 30
YEAR = 80
anacronJobIdentify(profile_id=None)[source]
anacronSpool()[source]
anacronSpoolFile(profile_id=None)[source]
anacrontab(suffix='')[source]

Deprecated since 1.1. Just keep this to delete old anacrontab files

anacrontabFiles()[source]

list existing old anacrontab files

appInstanceFile()[source]
backupOnRestore(profile_id=None)[source]
backupScheduled(profile_id=None)[source]

check if profile is supposed to be run this time

bwlimit(profile_id=None)[source]
bwlimitEnabled(profile_id=None)[source]
canBackup(profile_id=None)[source]

Checks if snapshots_path exists

checkConfig()[source]
continueOnErrors(profile_id=None)[source]
createNewCrontab(oldCrontab)[source]
cronCmd(profile_id)[source]
cronEnvFile()[source]
cronLine(profile_id)[source]
customBackupTime(profile_id=None)[source]
decrement_manual_starts_countdown()[source]

Counts down to -1.

See manual_starts_countdown() for details.

dontRemoveNamedSnapshots(profile_id=None)[source]
encfsconfigBackupFolder(profile_id=None)[source]
exclude(profile_id=None)[source]

Gets the exclude patterns

excludeBySize(profile_id=None)[source]
excludeBySizeEnabled(profile_id=None)[source]
excludeV4(profile_id=None)[source]

Gets the exclude patterns: conf version 4

fileId(profile_id=None)[source]
globalFlock()[source]
hashCollision()[source]
host()[source]
hostUserProfile(profile_id=None)[source]
hostUserProfileDefault(profile_id=None)[source]
include(profile_id=None)[source]
includeV4(profile_id=None)[source]
incrementHashCollision()[source]
ioniceOnCron(profile_id=None)[source]
ioniceOnRemote(profile_id=None)[source]
ioniceOnUser(profile_id=None)[source]
isConfigured(profile_id=None)[source]

Checks if the program is configured

keepOnlyOneSnapshot(profile_id=None)[source]
keyringServiceName(profile_id=None, mode=None, pw_id=1)[source]
keyringUserName(profile_id=None)[source]
language() str[source]
language_used

ISO-639 language code of the used language. See tools._determine_current_used_language_code() for details.

localEncfsPath(profile_id=None)[source]
logLevel(profile_id=None)[source]
manual_starts_countdown() int[source]

Countdown value about how often the users started the Back In Time GUI.

It is an internal variable not meant to be used or manipulated be the users. At the end of the countown the ApproachTranslatorDialog is presented to the user.

minFreeInodes(profile_id=None)[source]
minFreeInodesEnabled(profile_id=None)[source]
minFreeSpace(profile_id=None)[source]
minFreeSpaceEnabled(profile_id=None)[source]
minFreeSpaceMib(profile_id=None)[source]
modeNeedPassword(mode, pw_id=1)[source]
niceOnCron(profile_id=None)[source]
niceOnRemote(profile_id=None)[source]
noSnapshotOnBattery(profile_id=None)[source]
nocacheOnLocal(profile_id=None)[source]
nocacheOnRemote(profile_id=None)[source]
notify(profile_id=None)[source]
olderThan(time, value, unit)[source]

return True if time is older than months, weeks, days or hours

oneFileSystem(profile_id=None)[source]
password(parent=None, profile_id=None, mode=None, pw_id=1, only_from_keyring=False)[source]
passwordCacheFifo()[source]
passwordCacheFolder()[source]
passwordCacheInfo()[source]
passwordCachePid()[source]
passwordSave(profile_id=None, mode=None)[source]
passwordUseCache(profile_id=None, mode=None)[source]
pid()[source]
preparePath(path)[source]
preserveAcl(profile_id=None)[source]
preserveXattr(profile_id=None)[source]
redirectStderrInCron(profile_id=None)[source]
redirectStdoutInCron(profile_id=None)[source]
removeOldCrontab(crontab)[source]
removeOldSnapshots(profile_id=None)[source]
removeOldSnapshotsDate(profile_id=None)[source]
removeOldSnapshotsEnabled(profile_id=None)[source]
restoreInstanceFile(profile_id=None)[source]
restoreLogFile(profile_id=None)[source]
rsyncOptions(profile_id=None)[source]
rsyncOptionsEnabled(profile_id=None)[source]
save()[source]

Save all options to file.

Parameters:

filename (str) – full path

Returns:

True if successful

Return type:

bool

scheduleDay(profile_id=None)[source]
scheduleMode(profile_id=None)[source]
scheduleRepeatedPeriod(profile_id=None)[source]
scheduleRepeatedUnit(profile_id=None)[source]
scheduleTime(profile_id=None)[source]
scheduleWeekday(profile_id=None)[source]
setBackupOnRestore(value, profile_id=None)[source]
setBwlimit(enabled, value, profile_id=None)[source]
setContinueOnErrors(value, profile_id=None)[source]
setCurrentHashId(hash_id)[source]
setCustomBackupTime(value, profile_id=None)[source]
setDontRemoveNamedSnapshots(value, profile_id=None)[source]
setExclude(values, profile_id=None)[source]
setExcludeBySize(enabled, value, profile_id=None)[source]
setGlobalFlock(value)[source]
setHostUserProfile(host, user, profile, profile_id=None)[source]
setInclude(values, profile_id=None)[source]
setIoniceOnCron(value, profile_id=None)[source]
setIoniceOnRemote(value, profile_id=None)[source]
setIoniceOnUser(value, profile_id=None)[source]
setKeepOnlyOneSnapshot(value, profile_id=None)[source]
setLanguage(language: str)[source]
setLocalEncfsPath(value, profile_id=None)[source]
setLogLevel(value, profile_id=None)[source]
setMinFreeInodes(enabled, value, profile_id=None)[source]
setMinFreeSpace(enabled, value, unit, profile_id=None)[source]
setNiceOnCron(value, profile_id=None)[source]
setNiceOnRemote(value, profile_id=None)[source]
setNoSnapshotOnBattery(value, profile_id=None)[source]
setNocacheOnLocal(value, profile_id=None)[source]
setNocacheOnRemote(value, profile_id=None)[source]
setNotify(value, profile_id=None)[source]
setOneFileSystem(value, profile_id=None)[source]
setPassword(password, profile_id=None, mode=None, pw_id=1)[source]
setPasswordSave(value, profile_id=None, mode=None)[source]
setPasswordUseCache(value, profile_id=None, mode=None)[source]
setPreserveAcl(value, profile_id=None)[source]
setPreserveXattr(value, profile_id=None)[source]
setRedirectStderrInCron(value, profile_id=None)[source]
setRedirectStdoutInCron(value, profile_id=None)[source]
setRemoveOldSnapshots(enabled, value, unit, profile_id=None)[source]
setRsyncOptions(enabled, value, profile_id=None)[source]
setScheduleDay(value, profile_id=None)[source]
setScheduleMode(value, profile_id=None)[source]
setScheduleRepeatedPeriod(value, profile_id=None)[source]
setScheduleRepeatedUnit(value, profile_id=None)[source]
setScheduleTime(value, profile_id=None)[source]
setScheduleWeekday(value, profile_id=None)[source]
setSmartRemove(value, keep_all, keep_one_per_day, keep_one_per_week, keep_one_per_month, profile_id=None)[source]
setSmartRemoveRunRemoteInBackground(value, profile_id=None)[source]
setSnapshotsMode(value, profile_id=None)[source]
setSnapshotsPath(value, profile_id=None, mode=None)[source]

Sets the snapshot path to value, initializes, and checks it

setSshCheckCommands(value, profile_id=None)[source]
setSshCheckPingHost(value, profile_id=None)[source]
setSshCipher(value, profile_id=None)[source]
setSshHost(value, profile_id=None)[source]
setSshMaxArgLength(value, profile_id=None)[source]
setSshPort(value, profile_id=None)[source]
setSshPrefix(enabled, value, profile_id=None)[source]
setSshPrivateKeyFile(value, profile_id=None)[source]
setSshSnapshotsPath(value, profile_id=None)[source]
setSshUser(value, profile_id=None)[source]
setTakeSnapshotRegardlessOfChanges(value, profile_id=None)[source]
setUseChecksum(value, profile_id=None)[source]
setupCron()[source]
smartRemove(profile_id=None)[source]
smartRemoveRunRemoteInBackground(profile_id=None)[source]
snapshotsFullPath(profile_id=None)[source]

Returns the full path for the snapshots: …/backintime/machine/user/profile_id/

snapshotsMode(profile_id=None)[source]
snapshotsPath(profile_id=None, mode=None, tmp_mount=False)[source]
sshCheckCommands(profile_id=None)[source]
sshCheckPingHost(profile_id=None)[source]
sshCipher(profile_id=None)[source]
sshCommand(cmd=None, custom_args=None, port=True, cipher=True, user_host=True, ionice=True, nice=True, quote=False, prefix=True, profile_id=None)[source]

Return SSH command with all arguments.

Parameters:
  • cmd (list) – command that should run on remote host

  • custom_args (list) – additional arguments paste to the command

  • port (bool) – use port from config

  • cipher (bool) – use cipher from config

  • user_host (bool) – use user@host from config

  • ionice (bool) – use ionice if configured

  • nice (bool) – use nice if configured

  • quote (bool) – quote remote command

  • prefix (bool) – use prefix from config before remote command

  • profile_id (str) – profile ID that should be used in config

Returns:

ssh command with chosen arguments

Return type:

list

sshDefaultArgs(profile_id=None)[source]

Default arguments used for ssh and sshfs commands.

Returns:

arguments for ssh

Return type:

list

sshHost(profile_id=None)[source]
sshHostUserPortPathCipher(profile_id=None)[source]
sshMaxArgLength(profile_id=None)[source]
sshPort(profile_id=None)[source]
sshPrefix(profile_id=None)[source]
sshPrefixCmd(profile_id=None, cmd_type=<class 'str'>)[source]
sshPrefixEnabled(profile_id=None)[source]
sshPrivateKeyFile(profile_id=None)[source]
sshPrivateKeyFolder()[source]
sshSnapshotsFullPath(profile_id=None)[source]

Returns the full path for the snapshots: …/backintime/machine/user/profile_id/

sshSnapshotsPath(profile_id=None)[source]
sshUser(profile_id=None)[source]
tag(profile_id=None)[source]
takeSnapshotInstanceFile(profile_id=None)[source]
takeSnapshotLogFile(profile_id=None)[source]
takeSnapshotMessageFile(profile_id=None)[source]
takeSnapshotProgressFile(profile_id=None)[source]
takeSnapshotRegardlessOfChanges(profile_id=None)[source]
takeSnapshotUserCallback()[source]
udevRulesPath()[source]
useChecksum(profile_id=None)[source]
user()[source]

portable way to get username cc by-sa 3.0 http://stackoverflow.com/a/19865396/1139841 author: techtonik http://stackoverflow.com/users/239247/techtonik

userCallbackNoLogging(profile_id=None)[source]