[NixOS] Restart mount bucket service on failure

This commit is contained in:
2024-10-24 17:04:55 -06:00
parent a7b24c0fa4
commit 1af9a5497b

View File

@@ -45,6 +45,8 @@ in {
serviceConfig = {
Type = "simple";
RemainAfterExit = true;
Restart = "on-failure"; # Restart the service on failure
RestartSec = 5; # Wait 5 seconds before restarti
ExecStartPre = [
"-${pkgs.util-linux}/bin/umount -f ${mount-path}"
"${pkgs.coreutils}/bin/mkdir -p ${mount-path}"
@@ -63,7 +65,8 @@ in {
${pkgs.util-linux}/bin/umount -f "${mount-path}" || true
${pkgs.gcsfuse}/bin/gcsfuse --implicit-dirs --key-file "${key-file}" "${bucket-name}" "${mount-path}"
fi
sleep 60
echo "Sleeping"
sleep 30
done
'';
User = "root";