mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 13:54:28 -07:00
ip pages
This commit is contained in:
parent
36ab1221c2
commit
c05fb35800
13 changed files with 497 additions and 9 deletions
|
@ -19,7 +19,7 @@ ip=$1
|
|||
mask=$2
|
||||
interface="${3-eth0}"
|
||||
user="${4-admin}"
|
||||
ip_status="${5-shared}"
|
||||
ip_status="${5-shared}" # can be dedicated as well
|
||||
ip_name=$6
|
||||
|
||||
# Includes
|
||||
|
|
|
@ -17,11 +17,11 @@ source $VESTA/func/main.sh
|
|||
|
||||
# Json function
|
||||
json_list_iface() {
|
||||
interfaces=$(cat /proc/net/dev | grep : | cut -f 1 -d : | tr -d ' ')
|
||||
dev=$(cat /proc/net/dev |grep : |cut -f 1 -d : |tr -d ' ' |grep -v lo)
|
||||
int_counter=$(echo "$interfaces" | wc -l)
|
||||
i=1
|
||||
echo '['
|
||||
for interface in $interfaces; do
|
||||
for interface in $dev; do
|
||||
if [ "$i" -lt "$int_counter" ]; then
|
||||
echo -e "\t\"$interface\","
|
||||
else
|
||||
|
@ -34,12 +34,12 @@ json_list_iface() {
|
|||
|
||||
# Shell function
|
||||
shell_list_iface() {
|
||||
interfaces=$(cat /proc/net/dev | grep : | cut -f 1 -d : | tr -d ' ')
|
||||
dev=$(cat /proc/net/dev |grep : |cut -f 1 -d : |tr -d ' ' |grep -v lo)
|
||||
if [ -z "$nohead" ]; then
|
||||
echo "INTERFACES"
|
||||
echo "----------"
|
||||
fi
|
||||
for interface in $interfaces; do
|
||||
for interface in $dev; do
|
||||
echo "$interface"
|
||||
done
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ conf=$VESTA/data/ips/$IP
|
|||
|
||||
# Defining fileds to select
|
||||
fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS $INTERFACE
|
||||
$NETMASK $DATE'
|
||||
$NETMASK $TIME $DATE'
|
||||
|
||||
# Listing ip
|
||||
case $format in
|
||||
|
|
64
bin/v_list_sys_users
Executable file
64
bin/v_list_sys_users
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
# info: list system users
|
||||
# options: [format]
|
||||
#
|
||||
# The function for obtaining the list of system users.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
format=${1-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_users() {
|
||||
users=$(grep @ /etc/passwd|cut -f 1 -d :)
|
||||
int_counter=$(echo "$users" | wc -l)
|
||||
i=1
|
||||
echo '['
|
||||
for user in $users; do
|
||||
if [ "$i" -lt "$int_counter" ]; then
|
||||
echo -e "\t\"$user\","
|
||||
else
|
||||
echo -e "\t\"$user\""
|
||||
fi
|
||||
(( ++i))
|
||||
done
|
||||
echo "]"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_users() {
|
||||
if [ -z "$nohead" ]; then
|
||||
echo "USERS"
|
||||
echo "----------"
|
||||
fi
|
||||
for user in $(grep @ /etc/passwd|cut -f 1 -d :); do
|
||||
echo "$user"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Listing domains
|
||||
case $format in
|
||||
json) json_list_users ;;
|
||||
plain) nohead=1; shell_list_users ;;
|
||||
shell) shell_list_users ;;
|
||||
*) check_args '1' '0' '[format]' ;;
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue