#! /bin/sh
ip="$1"
name="$2" # jailname
path="$3"
shift;shift;shift
# end the rest
note="$@"
ip_no_mask=`echo -n ${ip}|cut -d/ -f 1|tr -d '\n'`
#echo $ip_no_mask
if ping -c 1 -W 1 $ip_no_mask >/dev/null 2>&1; then
echo "[$name] IP $ip_no_mask already in use, skipping start.";
exit 1;
else
echo "[$name] IP $ip_no_mask does not reply we can start";
fi;
/root/bin/jailCreateEpair.sh $name
mkdir -p ${path}/etc/ovps_shared
echo -n "# $note
ext_if=\"B$name\"
ext_ip=\"$ip_no_mask\"">$path/etc/pf_local_definitions.conf
mount_nullfs -o ro /etc/ovps_shared ${path}/etc/ovps_shared