This commit is contained in:
Serghey Rodin 2012-06-30 00:37:48 +03:00
commit c05fb35800
13 changed files with 497 additions and 9 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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
View 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