commit 0a3ab78e6a4e8729eed6b4f248a1f4d771567717
parent 099a4902eccbef0fa3e9048fec0503dbbe272def
Author: breadcat <breadcat@users.noreply.github.com>
Date: Thu, 28 May 2026 16:11:45 +0100
Attempt to move tank-sort to systemd timers
Diffstat:
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/machines/ilias.nix b/machines/ilias.nix
@@ -74,7 +74,6 @@ let machine = "ilias"; in {
cron = {
enable = true;
systemCronJobs = [
- "0 */4 * * * ${vars.user.username} . /etc/profile; tank-sort"
"0 */12 * * * ${vars.user.username} backup-cloud"
];
};
diff --git a/scripts/tank-sort.nix b/scripts/tank-sort.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ pkgs, vars, ... }:
let
media-sort = pkgs.callPackage ../common/media-sort.nix {};
@@ -93,5 +93,23 @@ let
echo "Media sort completed successfully"
'';
in {
- environment.systemPackages = [tank-sort media-sort];
+ environment.systemPackages = [ tank-sort media-sort ];
+
+ systemd.services.tank-sort = {
+ description = "Sort media from rclone remote";
+ serviceConfig = {
+ Type = "oneshot";
+ User = vars.user.username;
+ ExecStart = "${tank-sort}/bin/tank-sort";
+ };
+ };
+
+ systemd.timers.tank-sort = {
+ description = "Run tank-sort every 4 hours";
+ wantedBy = [ "timers.target" ];
+ timerConfig = {
+ OnCalendar = "*-*-* 00/4:00:00";
+ Persistent = true;
+ };
+ };
}