Skip to content

Commit 05ba096

Browse files
committed
ip disown script
1 parent 0a0dc0a commit 05ba096

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

bin/v_del_sys_user_ips

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
# info: deliting system user ips
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Argument defenition
9+
user=$1
10+
11+
# Importing variables
12+
source $VESTA/conf/vars.conf
13+
source $V_CONF/vesta.conf
14+
source $V_FUNC/shared.func
15+
source $V_FUNC/ip.func
16+
17+
18+
#----------------------------------------------------------#
19+
# Verifications #
20+
#----------------------------------------------------------#
21+
22+
# Checking arg number
23+
check_args '1' "$#" 'user'
24+
25+
# Checking argument format
26+
format_validation 'user'
27+
28+
# Checking user
29+
is_user_valid
30+
31+
# Checking user is active
32+
is_user_suspended
33+
34+
# Checking user vesta
35+
if [ "$user" = 'vesta' ]; then
36+
exit
37+
fi
38+
39+
#----------------------------------------------------------#
40+
# Action #
41+
#----------------------------------------------------------#
42+
43+
# Parsing user ips
44+
ip_list=$(grep -H "OWNER='$user'" $V_IPS/* | cut -f 1 -d:)
45+
46+
for ip in $ip_list; do
47+
ip=$(basename $ip)
48+
49+
# Checking webdomains and users
50+
is_ip_key_empty '$U_WEB_DOMAINS'
51+
is_ip_key_empty '$U_SYS_USERS'
52+
53+
# Assig ip to main account
54+
update_sys_ip_value '$OWNER' 'vesta'
55+
update_sys_ip_value '$STATUS' 'exclusive'
56+
57+
done
58+
59+
60+
#----------------------------------------------------------#
61+
# Vesta #
62+
#----------------------------------------------------------#
63+
64+
# Logging
65+
log_event 'system' "$V_EVENT"
66+
67+
exit

0 commit comments

Comments
 (0)