make systemd services more robust
This commit is contained in:
parent
9be05afa2d
commit
30b103d349
2 changed files with 7 additions and 55 deletions
|
|
@ -28,16 +28,14 @@
|
||||||
Description = "Mount Synology NAS with Rclone and Home Manager.";
|
Description = "Mount Synology NAS with Rclone and Home Manager.";
|
||||||
After = [ "tailscaled.service" ];
|
After = [ "tailscaled.service" ];
|
||||||
Wants = [ "tailscaled.service" ];
|
Wants = [ "tailscaled.service" ];
|
||||||
|
StartLimitBurst = 5;
|
||||||
|
StartLimitIntervalSec = "1m";
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
# ExecStartPre = "${pkgs.writeShellScript "synology-prep" ''
|
Restart = "on-failure";
|
||||||
# if mountpoint -q %h/Synology; then
|
RestartSec = "1m";
|
||||||
# /run/wrappers/bin/fusermount -uz %h/Synology
|
|
||||||
# fi
|
|
||||||
# ${pkgs.coreutils}/bin/mkdir -p %h/Synology
|
|
||||||
# ''}";
|
|
||||||
ExecStart = "${pkgs.writeShellScript "synology-mount" ''
|
ExecStart = "${pkgs.writeShellScript "synology-mount" ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
@ -65,49 +63,4 @@
|
||||||
WantedBy = [ "default.target" ];
|
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" ];
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
systemd.user.services.awww-daemon = {
|
systemd.user.services.awww-daemon = {
|
||||||
Unit.Description = "Wallpaper service using awww (daemon)";
|
Unit.Description = "Wallpaper service using awww (daemon)";
|
||||||
Service.ExecStart = "${pkgs.awww}/bin/awww-daemon";
|
Service.ExecStart = "${pkgs.awww}/bin/awww-daemon";
|
||||||
Unit.After = [ "graphical-session.target" ];
|
|
||||||
Unit.PartOf = [ "graphical-session.target" ];
|
|
||||||
Install.WantedBy = [ "graphical-session.target" ];
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -26,10 +24,10 @@
|
||||||
|
|
||||||
systemd.user.services.bing-wallpaper = {
|
systemd.user.services.bing-wallpaper = {
|
||||||
Unit.Description = "Download and set Bing wallpaper of the day";
|
Unit.Description = "Download and set Bing wallpaper of the day";
|
||||||
Unit.StartLimitBurst = 5;
|
Unit.StartLimitBurst = 6;
|
||||||
Unit.StartLimitIntervalSec = "10m";
|
Unit.StartLimitIntervalSec = "10m";
|
||||||
Service.Restart = "on-failure";
|
Service.Restart = "on-failure";
|
||||||
Service.RestartSec = "1m";
|
Service.RestartSec = "10s";
|
||||||
Service.Type = "oneshot";
|
Service.Type = "oneshot";
|
||||||
Service.ExecStart = pkgs.lib.getExe (
|
Service.ExecStart = pkgs.lib.getExe (
|
||||||
pkgs.writeShellApplication {
|
pkgs.writeShellApplication {
|
||||||
|
|
@ -68,6 +66,7 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
Service.ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart awww-setter.service";
|
Service.ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart awww-setter.service";
|
||||||
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.timers.bing-wallpaper = {
|
systemd.user.timers.bing-wallpaper = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue