mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-18 10:47:31 -08:00
add scripts to stop and restore docker containers
This commit is contained in:
parent
a3b215d262
commit
50cdb40912
@ -3,10 +3,25 @@
|
||||
# Password-less logins for backup
|
||||
users.users."${user}".openssh.authorizedKeys.keyFiles = [
|
||||
config.age.secrets."ssh/kestrel/id_ed25519.pub".path
|
||||
config.age.secrets."ssh/torus/id_ed25519.pub".path
|
||||
];
|
||||
|
||||
services.borgmatic.enable = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
borgbackup # Deduplicating backup program
|
||||
(pkgs.writeScriptBin "stop-docker-containers" ''
|
||||
#!/bin/sh
|
||||
[ -e /tmp/docker_images ] && rm /tmp/docker_images
|
||||
images=$(docker ps -a -q)
|
||||
echo "$images" > /tmp/docker_images
|
||||
docker stop $images
|
||||
'')
|
||||
(pkgs.writeScriptBin "restore-docker-containers" ''
|
||||
#!/bin/sh
|
||||
[ ! -e /tmp/docker_images ] && exit 0
|
||||
docker start $(cat /tmp/docker_images)
|
||||
rm /tmp/docker_images
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user