Last active
December 29, 2024 22:59
-
-
Save dch/ec05fa084a58040d4d5760447cd31d0d to your computer and use it in GitHub Desktop.
lua jail API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/libexec/flua | |
local jail = require("jail") | |
local i = 0; | |
for j in jail.list({"name"}) do | |
i = i + 1 | |
if i % 100 == 0 then | |
print(j["name"]) | |
end | |
end | |
print(i .. " jails") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/libexec/flua | |
local jail = require("jail") | |
for j in jail.list({"name", "host.hostname", "path", "ip4.addr"}) do | |
print(j["jid"] .. " " .. j["ip4.addr"] .. " " .. j["name"] .. " " .. j["host.hostname"] .. " " .. j["path"]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/libexec/flua | |
local jail = require("jail") | |
local create = { | |
path = "/", | |
persist = "true", | |
} | |
local destroy = { | |
persist = "false", | |
} | |
for i=1,999999 do | |
local name = "woop_" .. string.format("%07d", i) | |
local jid, err = jail.setparams(name, create, jail.CREATE or jail.UPDATE) | |
if not jid then | |
print(string.format("FAIL: creating %s: %s", name, err)) | |
end | |
if i % 1000 == 0 then | |
print("DONE " .. name) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/libexec/flua | |
local jail = require("jail") | |
local i = 0; | |
for j in jail.list({"name"}) do | |
i = i + 1 | |
print(j["name"]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment