File tree Expand file tree Collapse file tree 2 files changed +11
-21
lines changed
Expand file tree Collapse file tree 2 files changed +11
-21
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,17 @@ user="$(get_ip_value '$OWNER')"
4646ip_status=" $( get_ip_value ' $STATUS' ) "
4747
4848# Deleting interface
49- get_current_interface
50- /sbin/ifconfig " $interface " down
51-
52- # Deleting startup script
53- rm -f $iconf -$interface
49+ interface=$( /sbin/ifconfig | grep -B1 " addr:$ip " | head -n 1 | cut -f 1 -d ' ' )
50+ if [ ! -z " $interface " ] && [ -z " $( echo $interface | cut -s -f2 -d :) " ]; then
51+ echo " Error: Main IP on interface"
52+ log_event " $E_FORBIDEN " " $EVENT "
53+ exit $E_FORBIDEN
54+ fi
55+ if [ ! -z " $interface " ]; then
56+ /sbin/ifconfig " $interface " down
57+ iconf=' /etc/sysconfig/network-scripts/ifcfg'
58+ rm -f $iconf -$interface
59+ fi
5460
5561# Deleting vesta ip
5662rm -f $VESTA /data/ips/$ip
Original file line number Diff line number Diff line change @@ -172,22 +172,6 @@ get_ip_value() {
172172 echo " $value "
173173}
174174
175- # Get current ip interface
176- get_current_interface () {
177- i=$( /sbin/ifconfig | grep -B1 " addr:$ip " | head -n 1 | cut -f 1 -d ' ' )
178- if [ -z " $i " ]; then
179- echo " Error: interface for ip $ip not found"
180- log_event " $E_NOTEXIST " " $EVENT "
181- exit $E_NOTEXIST
182- fi
183- if [ -z " $( echo $i | cut -s -f 2 -d :) " ]; then
184- echo " Error: Main IP on interface"
185- log_event " $E_FORBIDEN " " $EVENT "
186- exit $E_FORBIDEN
187- fi
188- interface=" $i "
189- }
190-
191175# Create ip vesta configuration
192176create_vesta_ip () {
193177 ip_data=" OWNER='$user '"
You can’t perform that action at this time.
0 commit comments