soulseek: added auto restart
This commit is contained in:
parent
cf90158871
commit
48ce3dfa79
|
@ -46,6 +46,9 @@ in
|
||||||
EOF 200
|
EOF 200
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Minecraft only autoupdates at startup
|
||||||
|
#
|
||||||
|
# To keep up with the update, restart the server at 4am everyday.
|
||||||
systemd =
|
systemd =
|
||||||
let serviceName = "podman-${name}"; in
|
let serviceName = "podman-${name}"; in
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
name = "soulseek";
|
name = "soulseek";
|
||||||
podman = config.profile.podman;
|
podman = config.profile.podman;
|
||||||
|
@ -23,6 +23,32 @@ in
|
||||||
chown ${uid}:${gid} ${rootVolume} ${rootVolume}/{config,downloads,incomplete}
|
chown ${uid}:${gid} ${rootVolume} ${rootVolume}/{config,downloads,incomplete}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
# Soulseek only autoscans on startup
|
||||||
|
#
|
||||||
|
# Once a day at 4am, restart the container to trigger a rescan
|
||||||
|
systemd =
|
||||||
|
let
|
||||||
|
serviceName = "podman-${name}-autorestart";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.${serviceName} = {
|
||||||
|
description = "Podman container ${name} autorestart";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${pkgs.podman}/bin/podman restart ${name}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
timers.${serviceName} = {
|
||||||
|
description = "Podman container ${name} autorestart";
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "*-*-* 04:00:00";
|
||||||
|
};
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
virtualisation.oci-containers.containers.${name} = {
|
virtualisation.oci-containers.containers.${name} = {
|
||||||
inherit image;
|
inherit image;
|
||||||
hostname = name;
|
hostname = name;
|
||||||
|
|
Loading…
Reference in a new issue