SirDice said:Don't rely on the JID, set a proper name for the jail. That's much easier to use.
# jls
JID IP Address Hostname Path
1 10.0.0.82 webtest.foobar.dom /usr/jails/webtest
# jexec webtest tcsh
jexec: jail "webtest" not found
-n jailname
Set the jail's name. This is deprecated and is equivalent to
setting the name parameter.
name The jail name. This is an arbitrary string that identifies a
jail (except it may not contain a `.'). Like the jid, it can be
passed to later jail commands, or to jls(8) or jexec(8). If no
name is supplied, a default is assumed that is the same as the
jid.
jail_list="sambatest"
jail_sambatest_hostname="samba-test.lala"
jail_sambatest_rootdir="/jails/j/samba.test"
jail_sambatest_devfs_enable="YES"
jail_sambatest_ip="192.168.12.12"
jail_sambatest_interface="lo2"
jail_sambatest_name="sambat"
[root@filesrv ~]# jls
19 192.168.12.12 samba-test.lsls /jails/j/samba.test
[root@filesrv ~]# jexec sambat bash
jexec: jail "sambat" not found
[root@filesrv ~]#