Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Skovhede <kenneth@hexad.dk>2018-03-20 11:19:01 +0300
committerGitHub <noreply@github.com>2018-03-20 11:19:01 +0300
commit3ec2b78828cda15d16f889f2dd612969f2c34225 (patch)
tree572791ef574070374d4e5ff6626d08a9e11c3652 /Duplicati/Server/Scheduler.cs
parent6545b5cfa416119a8dfe67be73016644fd36bf18 (diff)
parent85214aaf9ab9be1929da2a3ae658151cd611c151 (diff)
Merge pull request #3086 from warwickmm/feature/disable_on_battery
Add option to disable backup when on battery power
Diffstat (limited to 'Duplicati/Server/Scheduler.cs')
-rw-r--r--Duplicati/Server/Scheduler.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/Duplicati/Server/Scheduler.cs b/Duplicati/Server/Scheduler.cs
index de8e7873c..fb01df458 100644
--- a/Duplicati/Server/Scheduler.cs
+++ b/Duplicati/Server/Scheduler.cs
@@ -34,6 +34,8 @@ namespace Duplicati.Server
/// </summary>
public class Scheduler
{
+ private static readonly string LOGTAG = Duplicati.Library.Logging.Log.LogTagFromType<Scheduler>();
+
/// <summary>
/// The thread that runs the scheduler
/// </summary>
@@ -278,7 +280,18 @@ namespace Duplicati.Server
{
var entry = Program.DataConnection.GetBackup(id);
if (entry != null)
- jobsToRun.Add(Server.Runner.CreateTask(Duplicati.Server.Serialization.DuplicatiOperation.Backup, entry));
+ {
+ Dictionary<string, string> options = Duplicati.Server.Runner.GetCommonOptions(entry, Duplicati.Server.Serialization.DuplicatiOperation.Backup);
+ Duplicati.Server.Runner.ApplyOptions(entry, Duplicati.Server.Serialization.DuplicatiOperation.Backup, options);
+ if ((new Duplicati.Library.Main.Options(options)).DisableOnBattery && (Duplicati.Library.Utility.Power.PowerSupply.GetSource() == Duplicati.Library.Utility.Power.PowerSupply.Source.Battery))
+ {
+ Duplicati.Library.Logging.Log.WriteInformationMessage(LOGTAG, "BackupDisabledOnBattery", "Scheduled backup disabled while on battery power.");
+ }
+ else
+ {
+ jobsToRun.Add(Server.Runner.CreateTask(Duplicati.Server.Serialization.DuplicatiOperation.Backup, entry));
+ }
+ }
}
}