mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 13:01:52 -07:00
fixed dublicates in ip listing for user vesta
This commit is contained in:
parent
74005a926c
commit
81a5d78850
1 changed files with 6 additions and 6 deletions
|
@ -23,15 +23,15 @@ json_list_user_ips() {
|
||||||
echo '{'
|
echo '{'
|
||||||
|
|
||||||
owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
|
owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
|
||||||
shared_ips=$(grep -A5 "OWNER='vesta'" $V_IPS/* |\
|
shared_ips=$(grep -H -A5 "OWNER='vesta'" $V_IPS/* |\
|
||||||
grep "STATUS='shared'"|\
|
grep "STATUS='shared'"|\
|
||||||
cut -f 1 -d - )
|
cut -f 1 -d - )
|
||||||
|
|
||||||
ip_list="$owned_ips $shared_ips"
|
ip_list="$owned_ips\n$shared_ips"
|
||||||
fileds_count=$(echo "$fields" | wc -w)
|
fileds_count=$(echo "$fields" | wc -w)
|
||||||
|
|
||||||
# Starting main loop
|
# Starting main loop
|
||||||
for IP in $ip_list; do
|
for IP in $(echo -e "$ip_list" | sort -u); do
|
||||||
IP=$(basename $IP)
|
IP=$(basename $IP)
|
||||||
ip_data=$(cat $V_IPS/$IP)
|
ip_data=$(cat $V_IPS/$IP)
|
||||||
|
|
||||||
|
@ -75,11 +75,11 @@ json_list_user_ips() {
|
||||||
# Shell function
|
# Shell function
|
||||||
shell_list_user_ips() {
|
shell_list_user_ips() {
|
||||||
owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
|
owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
|
||||||
shared_ips=$(grep -A5 "OWNER='vesta'" $V_IPS/* |\
|
shared_ips=$(grep -H -A5 "OWNER='vesta'" $V_IPS/* |\
|
||||||
grep "STATUS='shared'"|\
|
grep "STATUS='shared'"|\
|
||||||
cut -f 1 -d - )
|
cut -f 1 -d - )
|
||||||
|
|
||||||
ip_list="$owned_ips $shared_ips"
|
ip_list="$owned_ips\n$shared_ips"
|
||||||
if [ -z "$nohead" ]; then
|
if [ -z "$nohead" ]; then
|
||||||
# Print brief info
|
# Print brief info
|
||||||
echo "${fields//$/}"
|
echo "${fields//$/}"
|
||||||
|
@ -90,7 +90,7 @@ shell_list_user_ips() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Starting main loop
|
# Starting main loop
|
||||||
for IP in $ip_list; do
|
for IP in $(echo -e "$ip_list" | sort -u); do
|
||||||
IP=$(basename $IP)
|
IP=$(basename $IP)
|
||||||
ip_data=$(cat $V_IPS/$IP)
|
ip_data=$(cat $V_IPS/$IP)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue