Anton - Valqk wrote:
Because I'm lazy and love the scripts, I wrote a nice small script that
matches a jailname and do a jexec JAILPID SHELL
so I can login fast to my jails.
According to me, there should be such tool!
Hopes something like this goes to STABLE!
here it is....
#!/bin/sh
loginSHELL="/bin/tcsh"
[ -z "$1" ] && echo "No jail specified." && exit 1;
jName=$1;
jID=`jls | awk '{print $1,$3}'|grep $jName|awk '{print $1}'`
jRealName=`jls | awk '{print $1,$3}'|grep $jName|awk '{print $2}'`
[ -z "$jID" ] && echo "No such jail name $jName!" && exit 1;
echo "Logging in to $jRealName"
jexec $jID $loginSHELL
It is nice idea, but I think you should have a better scripting style ;)
#!/bin/sh
login_shell="/bin/tcsh"
if [ -z "$1" ]; then
echo "No jail specified."
exit 1
fi
jail_name=$1
jail_id=`jls | awk '$3 ~ /^'${jail_name}'\./ { print $1 }'`
jail_hostname=`jls | awk '$3 ~ /^'${jail_name}'\./ { print $3 }'`
if [ -z "$jail_id" ]; then
echo "No such jail name ${jail_name}!"
exit 1
fi
echo "Logging in to ${jail_hostname}"
jexec $jail_id $login_shell
And still there are some imperfections.
1) script assume first part of a hostname as name, but in the rc.conf
jail name can be different
2) script does not expect multiple occurrence of the same first part of
a hostname
example: johndoe.example.org and johndoe.comethingelse.org
3) script does not expect multiple occurrence of exactly matching
hostname (coused by jail zombies)
Miroslav Lachman
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"