Jail usage: Difference between revisions

From wikinotes
No edit summary
 
Line 22: Line 22:
</source>
</source>
</blockquote><!-- jls -->
</blockquote><!-- jls -->
= scripts =
<blockquote>
<syntaxhighlight lang="bash">
# print jails, and their configured vnet ip addresses
cat /etc/jail.conf | awk '/(^[a-zA-Z0-9_]+) {/ { foo=$1; getline; print foo " " $3 }' | column -t
</syntaxhighlight>
</blockquote><!-- scripts -->

Latest revision as of 14:45, 11 June 2022

Basics

# basics
jls                         # list all jails
jexec ${jail}               # enter jail
service jail start ${jail}  # start jail

jexec ${jail} <command>          # run command in jail
jexec ${jail} -u will <command>  # run command as user in jail

for jid in $(jls | tail +2 | awk '{ print $1 }'); do yes | sudo pkg -j $jid -y upgrade; done

jls

jls -s                                      # list all avail jail headers on all jails
jls -h jid name osrelease path | column -t  # print some info

scripts

# print jails, and their configured vnet ip addresses
cat /etc/jail.conf | awk '/(^[a-zA-Z0-9_]+) {/ { foo=$1; getline; print foo " " $3 }' | column -t