mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
new improved template scheme
This commit is contained in:
parent
14687f170a
commit
fd4e68bb8c
96 changed files with 1395 additions and 1425 deletions
28
func/ip.sh
28
func/ip.sh
|
@ -45,9 +45,7 @@ is_ip_owner() {
|
|||
|
||||
# Check if ip address is free
|
||||
is_ip_free() {
|
||||
list=$(/sbin/ifconfig |grep 'inet addr:' |cut -f 2 -d : |cut -f 1 -d ' ')
|
||||
ip_check=$(echo "$list" |grep -w "$ip")
|
||||
if [ -n "$ip_check" ] || [ -e "$VESTA/data/ips/$ip" ]; then
|
||||
if [ -e "$VESTA/data/ips/$ip" ]; then
|
||||
echo "Error: IP exist"
|
||||
log_event "$E_EXISTS" "$EVENT"
|
||||
exit $E_EXISTS
|
||||
|
@ -174,30 +172,6 @@ get_ip_value() {
|
|||
echo "$value"
|
||||
}
|
||||
|
||||
# Create ip vesta configuration
|
||||
create_vesta_ip() {
|
||||
ip_data="OWNER='$user'"
|
||||
ip_data="$ip_data\nSTATUS='$ip_status'"
|
||||
ip_data="$ip_data\nNAME='$ip_name'"
|
||||
ip_data="$ip_data\nU_SYS_USERS=''"
|
||||
ip_data="$ip_data\nU_WEB_DOMAINS='0'"
|
||||
ip_data="$ip_data\nINTERFACE='$interface'"
|
||||
ip_data="$ip_data\nNETMASK='$mask'"
|
||||
ip_data="$ip_data\nNAT='$nat_ip'"
|
||||
ip_data="$ip_data\nTIME='$TIME'"
|
||||
ip_data="$ip_data\nDATE='$DATE'"
|
||||
echo -e "$ip_data" >$VESTA/data/ips/$ip
|
||||
chmod 660 $VESTA/data/ips/$ip
|
||||
}
|
||||
|
||||
# Create ip address startup configuration
|
||||
create_ip_startup() {
|
||||
ip_data="# Added by vesta $SCRIPT\nDEVICE=$iface"
|
||||
ip_data="$ip_data\nBOOTPROTO=static\nONBOOT=yes\nIPADDR=$ip"
|
||||
ip_data="$ip_data\nNETMASK=$mask"
|
||||
echo -e "$ip_data" > $iconf-$iface
|
||||
}
|
||||
|
||||
# Get real ip address
|
||||
get_real_ip() {
|
||||
if [ -e "$VESTA/data/ips/$1" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue