make systemd services more robust

This commit is contained in:
Sean Kovacs 2026-02-21 09:48:03 -05:00
commit 151f574d25
Signed by: sckova
GPG key ID: 00F325187C68651A
2 changed files with 7 additions and 55 deletions

View file

@ -28,16 +28,14 @@
Description = "Mount Synology NAS with Rclone and Home Manager.";
After = [ "tailscaled.service" ];
Wants = [ "tailscaled.service" ];
StartLimitBurst = 5;
StartLimitIntervalSec = "1m";
};
Service = {
Type = "simple";
# ExecStartPre = "${pkgs.writeShellScript "synology-prep" ''
# if mountpoint -q %h/Synology; then
# /run/wrappers/bin/fusermount -uz %h/Synology
# fi
# ${pkgs.coreutils}/bin/mkdir -p %h/Synology
# ''}";
Restart = "on-failure";
RestartSec = "1m";
ExecStart = "${pkgs.writeShellScript "synology-mount" ''
#!/usr/bin/env bash
set -euo pipefail
@ -65,49 +63,4 @@
WantedBy = [ "default.target" ];
};
};
# systemd.user.services.synology-prefill = {
# Unit = {
# Description = "Prefill Synology NAS rclone cache";
# After = [ "synology-mount.service" ];
# Wants = [ "synology-mount.service" ];
# };
# Service = {
# Type = "simple";
# ExecStart = "${pkgs.writeShellScript "synology-prefill" ''
# #!/usr/bin/env bash
# set -euo pipefail
# ${pkgs.rclone}/bin/rclone rc vfs/refresh -v --fast-list recursive=true >/dev/null
# ''}";
# StandardOutput = "journal";
# StandardError = "journal";
# Restart = "on-failure";
# };
# Install = {
# WantedBy = [ "default.target" ];
# };
# };
# systemd.user.services.input-leap = {
# Unit = {
# Description = "Autostart Input Leap";
# After = [ "graphical-session.target" ];
# };
# Service = {
# Type = "oneshot";
# RemainAfterExit = true;
# PassEnvironment = "DISPLAY";
# ExecStart = "${pkgs.writeShellScript "input-leap-start" ''
# sleep 5
# ${pkgs.input-leap}/bin/input-leap
# ''}";
# };
# Install = {
# WantedBy = [ "graphical-session.target" ];
# };
# };
}

View file

@ -6,8 +6,6 @@
systemd.user.services.awww-daemon = {
Unit.Description = "Wallpaper service using awww (daemon)";
Service.ExecStart = "${pkgs.awww}/bin/awww-daemon";
Unit.After = [ "graphical-session.target" ];
Unit.PartOf = [ "graphical-session.target" ];
Install.WantedBy = [ "graphical-session.target" ];
};
@ -26,10 +24,10 @@
systemd.user.services.bing-wallpaper = {
Unit.Description = "Download and set Bing wallpaper of the day";
Unit.StartLimitBurst = 5;
Unit.StartLimitBurst = 6;
Unit.StartLimitIntervalSec = "10m";
Service.Restart = "on-failure";
Service.RestartSec = "1m";
Service.RestartSec = "10s";
Service.Type = "oneshot";
Service.ExecStart = pkgs.lib.getExe (
pkgs.writeShellApplication {
@ -68,6 +66,7 @@
}
);
Service.ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart awww-setter.service";
Install.WantedBy = [ "graphical-session.target" ];
};
systemd.user.timers.bing-wallpaper = {