@@ -22,34 +22,22 @@ user="${4-admin}"
2222ip_status=" ${5-shared} "
2323ip_name=$6
2424
25- # Importing variables
25+ # Includes
2626source $VESTA /conf/vesta.conf
2727source $VESTA /func/shared.sh
2828source $VESTA /func/ip.sh
29- source $VESTA /func/domain.sh # for namehosting
29+ source $VESTA /func/domain.sh
30+
3031
3132# ----------------------------------------------------------#
3233# Verifications #
3334# ----------------------------------------------------------#
3435
35- # Checking arg number
3636check_args ' 2' " $# " ' ip mask [interface] [user] [ip_status] [ip_name]'
37-
38- # Checking argument format
39- validate_format ' ip' ' mask' ' interface' ' user'
40-
41- # Checking system ip
42- is_sys_ip_free
43-
44- # Checking user
45- is_object_valid ' user' ' USER' " $user " " $user "
46-
47- # Checking ip_status
48- if [ ! -z " $ip_status " ]; then
49- validate_format ' ip_status'
50- fi
51-
52- # Checking ip_name
37+ validate_format ' ip' ' mask' ' interface' ' user' ' ip_status'
38+ is_ip_free
39+ is_object_valid ' user' ' USER' " $user "
40+ is_object_unsuspended ' user' ' USER' " $user "
5341if [ ! -z " $ip_name " ] ; then
5442 validate_format ' ip_name'
5543fi
5947# Action #
6048# ----------------------------------------------------------#
6149
62- # Get interface number
63- i_number=$( get_next_interface_number)
64- iface=" $interface$i_number "
50+ # Get full interface name
51+ get_ip_iface
6552
6653# Defining config paths
6754conf=' /etc/httpd/conf.d/vesta.conf'
@@ -73,15 +60,12 @@ rconf='/etc/httpd/conf.d/rpaf.conf'
7360/sbin/ifconfig " $iface " " $ip " netmask " $mask "
7461
7562# Adding startup script
76- ip_add_startup
63+ create_ip_startup
7764
7865# Adding vesta ip
79- ip_add_vesta
80-
81- # Importing main config
82- source $VESTA /conf/vesta.conf
66+ create_vesta_ip
8367
84- # Adding namehosting support
68+ # Namehosting support
8569namehost_ip_support
8670
8771
@@ -93,7 +77,7 @@ namehost_ip_support
9377increase_user_value " $user " ' $IP_OWNED'
9478if [ " $user " = ' admin' ]; then
9579 if [ " $ip_status " = ' shared' ]; then
96- for user in $( ls $V_USERS / ) ; do
80+ for user in $( ls $VESTA /data/users ) ; do
9781 increase_user_value " $user " ' $IP_AVAIL'
9882 done
9983 else
10488 increase_user_value ' admin' ' $IP_AVAIL'
10589fi
10690
107- # Adding task to the vesta pipe
91+ # Restart web server
10892if [ " $web_restart " = ' yes' ]; then
10993 $BIN /v_restart_web " $EVENT "
11094fi
0 commit comments