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