mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 07:31:26 +00:00
nixos-container: Add status command
This commit is contained in:
parent
ab7b973b33
commit
e7860f04c2
@ -21,6 +21,7 @@ Usage: nixos-container list
|
||||
nixos-container destroy <container-name>
|
||||
nixos-container start <container-name>
|
||||
nixos-container stop <container-name>
|
||||
nixos-container status <container-name>
|
||||
nixos-container login <container-name>
|
||||
nixos-container root-login <container-name>
|
||||
nixos-container run <container-name> -- args...
|
||||
@ -155,7 +156,11 @@ my $profileDir = "/nix/var/nix/profiles/per-container/$containerName";
|
||||
my $gcRootsDir = "/nix/var/nix/gcroots/per-container/$containerName";
|
||||
my $confFile = "/etc/containers/$containerName.conf";
|
||||
if (!-e $confFile) {
|
||||
exit 0 if $action eq "destroy";
|
||||
if ($action eq "destroy") {
|
||||
exit 0;
|
||||
} else {
|
||||
print "gone\n";
|
||||
}
|
||||
die "$0: container ‘$containerName’ does not exist\n" ;
|
||||
}
|
||||
|
||||
@ -190,6 +195,10 @@ elsif ($action eq "stop") {
|
||||
stopContainer;
|
||||
}
|
||||
|
||||
elsif ($action eq "status") {
|
||||
print isContainerRunning() ? "up" : "down", "\n";
|
||||
}
|
||||
|
||||
elsif ($action eq "update") {
|
||||
my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user