mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
Merged with upstream
This commit is contained in:
commit
52bdfc3aab
2 changed files with 382 additions and 191 deletions
|
@ -1,188 +1,379 @@
|
||||||
#!/bin/bash
|
<<<<<<< HEAD
|
||||||
# info: list system config
|
#!/bin/bash
|
||||||
# options: [FORMAT]
|
# info: list system config
|
||||||
#
|
# options: [FORMAT]
|
||||||
# The function for obtaining the list of system parameters.
|
#
|
||||||
|
# The function for obtaining the list of system parameters.
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
|
||||||
# Variable&Function #
|
#----------------------------------------------------------#
|
||||||
#----------------------------------------------------------#
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
# Argument defenition
|
|
||||||
format=${1-shell}
|
# Argument defenition
|
||||||
|
format=${1-shell}
|
||||||
# Includes
|
|
||||||
source $VESTA/conf/vesta.conf
|
# Includes
|
||||||
source $VESTA/func/main.sh
|
source $VESTA/conf/vesta.conf
|
||||||
|
source $VESTA/func/main.sh
|
||||||
get_srv_state() {
|
|
||||||
srv=$1
|
get_srv_state() {
|
||||||
proc_name=${2-$1}
|
srv=$1
|
||||||
|
proc_name=${2-$1}
|
||||||
# Check service status
|
|
||||||
/etc/init.d/$srv status > /dev/null 2>&1
|
# Check service status
|
||||||
if [ $? -eq 0 ]; then
|
/etc/init.d/$srv status > /dev/null 2>&1
|
||||||
state='running'
|
if [ $? -eq 0 ]; then
|
||||||
|
state='running'
|
||||||
# Calculate cpu and memory usage
|
|
||||||
cpu=0
|
# Calculate cpu and memory usage
|
||||||
mem=0
|
cpu=0
|
||||||
for pid in $(/sbin/pidof $proc_name); do
|
mem=0
|
||||||
pid_mem=$(pmap -x $pid | tail -n1 | awk '{print $3}')
|
for pid in $(/sbin/pidof $proc_name); do
|
||||||
pid_cpu=$(grep "^$pid " $tmp_file | cut -f 2 -d ' ')
|
pid_mem=$(pmap -x $pid | tail -n1 | awk '{print $3}')
|
||||||
cpu=$((cpu + pid_cpu))
|
pid_cpu=$(grep "^$pid " $tmp_file | cut -f 2 -d ' ')
|
||||||
mem=$((mem + pid_mem))
|
cpu=$((cpu + pid_cpu))
|
||||||
done
|
mem=$((mem + pid_mem))
|
||||||
mem=$((mem / 1024))
|
done
|
||||||
|
mem=$((mem / 1024))
|
||||||
# Get pid date
|
|
||||||
if [ ! -z $pid ] && [ -e "/proc/$pid/cmdline" ]; then
|
# Get pid date
|
||||||
mtime=$(stat -c "%Y" /proc/$pid/cmdline)
|
if [ ! -z $pid ] && [ -e "/proc/$pid/cmdline" ]; then
|
||||||
rtime=$((ctime - mtime))
|
mtime=$(stat -c "%Y" /proc/$pid/cmdline)
|
||||||
rtime=$((rtime / 60))
|
rtime=$((ctime - mtime))
|
||||||
fi
|
rtime=$((rtime / 60))
|
||||||
else
|
fi
|
||||||
# Service is stopped
|
else
|
||||||
state='stopped'
|
# Service is stopped
|
||||||
mem=0
|
state='stopped'
|
||||||
cpu=0
|
mem=0
|
||||||
rtime="0"
|
cpu=0
|
||||||
fi
|
rtime="0"
|
||||||
}
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
|
||||||
# Action #
|
#----------------------------------------------------------#
|
||||||
#----------------------------------------------------------#
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
# Save current proccess list
|
|
||||||
tmp_file=$(mktemp)
|
# Save current proccess list
|
||||||
if [ "$format" = 'json' ]; then
|
tmp_file=$(mktemp)
|
||||||
ps aux | awk '{print $2" "$3}' | tr -d '.' > $tmp_file
|
if [ "$format" = 'json' ]; then
|
||||||
else
|
ps aux | awk '{print $2" "$3}' | tr -d '.' > $tmp_file
|
||||||
ps aux | awk '{print $2" "$3}' | cut -f 1 -d '.' > $tmp_file
|
else
|
||||||
fi
|
ps aux | awk '{print $2" "$3}' | cut -f 1 -d '.' > $tmp_file
|
||||||
|
fi
|
||||||
# Get current time
|
|
||||||
ctime=$(date +%s)
|
# Get current time
|
||||||
|
ctime=$(date +%s)
|
||||||
# Proxy
|
|
||||||
service=$PROXY_SYSTEM
|
# Proxy
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$PROXY_SYSTEM
|
||||||
get_srv_state $service
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
str="NAME='$service' SYSTEM='reverse proxy' STATE='$state' CPU='$cpu'"
|
get_srv_state $service
|
||||||
str="$str MEM='$mem' RTIME='$rtime'"
|
str="NAME='$service' SYSTEM='reverse proxy' STATE='$state' CPU='$cpu'"
|
||||||
fi
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# Web
|
|
||||||
service=$WEB_SYSTEM
|
# Web
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$WEB_SYSTEM
|
||||||
if [ "$service" == 'apache' ]; then
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
service='httpd'
|
if [ "$service" == 'apache' ]; then
|
||||||
fi
|
service='httpd'
|
||||||
get_srv_state $service
|
fi
|
||||||
str="$str\nNAME='$service' SYSTEM='web server' STATE='$state' CPU='$cpu'"
|
get_srv_state $service
|
||||||
str="$str MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='web server' STATE='$state' CPU='$cpu'"
|
||||||
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
fi
|
|
||||||
|
fi
|
||||||
# DNS
|
|
||||||
service=$DNS_SYSTEM
|
# DNS
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$DNS_SYSTEM
|
||||||
if [ "$service" == 'bind' ]; then
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
service='named'
|
if [ "$service" == 'bind' ]; then
|
||||||
fi
|
service='named'
|
||||||
get_srv_state $service
|
fi
|
||||||
str="$str\nNAME='$service' SYSTEM='dns server' STATE='$state' CPU='$cpu'"
|
get_srv_state $service
|
||||||
str="$str MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='dns server' STATE='$state' CPU='$cpu'"
|
||||||
fi
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# MAIL
|
|
||||||
service=$MAIL_SYSTEM
|
# MAIL
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$MAIL_SYSTEM
|
||||||
get_srv_state $service
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
str="$str\nNAME='$service' SYSTEM='mail server' STATE='$state' CPU='$cpu'"
|
get_srv_state $service
|
||||||
str="$str MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='mail server' STATE='$state' CPU='$cpu'"
|
||||||
fi
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# IMAP
|
|
||||||
service=$IMAP_SYSTEM
|
# IMAP
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$IMAP_SYSTEM
|
||||||
get_srv_state $service
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
str="$str\nNAME='$service' SYSTEM='pop/imap server' STATE='$state'"
|
get_srv_state $service
|
||||||
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='pop/imap server' STATE='$state'"
|
||||||
fi
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# ANTIVIRUS
|
|
||||||
service=$ANTIVIRUS_SYSTEM
|
# ANTIVIRUS
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$ANTIVIRUS_SYSTEM
|
||||||
if [ "$ANTIVIRUS_SYSTEM" = 'clamav' ]; then
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
service='clamd'
|
if [ "$ANTIVIRUS_SYSTEM" = 'clamav' ]; then
|
||||||
fi
|
service='clamd'
|
||||||
get_srv_state $service
|
fi
|
||||||
str="$str\nNAME='$service' SYSTEM='email antivirus' STATE='$state'"
|
get_srv_state $service
|
||||||
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='email antivirus' STATE='$state'"
|
||||||
fi
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# ANTISPAM
|
|
||||||
service=$ANTISPAM_SYSTEM
|
# ANTISPAM
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$ANTISPAM_SYSTEM
|
||||||
get_srv_state $service spamd
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
str="$str\nNAME='$service' SYSTEM='email antispam' STATE='$state'"
|
get_srv_state $service spamd
|
||||||
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='email antispam' STATE='$state'"
|
||||||
fi
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# DB
|
|
||||||
service=$DB_SYSTEM
|
# DB
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$DB_SYSTEM
|
||||||
for db in ${DB_SYSTEM//,/ }; do
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
service="$db"
|
for db in ${DB_SYSTEM//,/ }; do
|
||||||
if [ "$service" == 'mysql' ] && [ ! -e "/etc/init.d/$service" ]; then
|
service="$db"
|
||||||
service='mysqld'
|
if [ "$service" == 'mysql' ] && [ ! -e "/etc/init.d/$service" ]; then
|
||||||
fi
|
service='mysqld'
|
||||||
get_srv_state $service
|
fi
|
||||||
str="$str\nNAME='$service' SYSTEM='database server' STATE='$state'"
|
get_srv_state $service
|
||||||
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='database server' STATE='$state'"
|
||||||
done
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
fi
|
done
|
||||||
|
fi
|
||||||
# FTP
|
|
||||||
service=$FTP_SYSTEM
|
# FTP
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$FTP_SYSTEM
|
||||||
get_srv_state $service
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
str="$str\nNAME='$service' SYSTEM='ftp server' STATE='$state' CPU='$cpu'"
|
get_srv_state $service
|
||||||
str="$str MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='ftp server' STATE='$state' CPU='$cpu'"
|
||||||
fi
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# CRON
|
|
||||||
service=$CRON_SYSTEM
|
# CRON
|
||||||
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
service=$CRON_SYSTEM
|
||||||
get_srv_state $service
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
str="$str\nNAME='$service' SYSTEM='job scheduler' STATE='$state'"
|
get_srv_state $service
|
||||||
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
str="$str\nNAME='$service' SYSTEM='job scheduler' STATE='$state'"
|
||||||
fi
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
# Defining config
|
|
||||||
echo -e "$str" > $tmp_file
|
# Defining config
|
||||||
conf=$tmp_file
|
echo -e "$str" > $tmp_file
|
||||||
|
conf=$tmp_file
|
||||||
# Defining fileds to select
|
|
||||||
fields="\$NAME \$SYSTEM \$STATE \$CPU \$MEM \$RTIME"
|
# Defining fileds to select
|
||||||
|
fields="\$NAME \$SYSTEM \$STATE \$CPU \$MEM \$RTIME"
|
||||||
# Listing services
|
|
||||||
case $format in
|
# Listing services
|
||||||
json) json_list ;;
|
case $format in
|
||||||
plain) nohead=1; shell_list ;;
|
json) json_list ;;
|
||||||
shell) fields='$NAME $STATE $CPU $MEM $RTIME'
|
plain) nohead=1; shell_list ;;
|
||||||
shell_list | column -t ;;
|
shell) fields='$NAME $STATE $CPU $MEM $RTIME'
|
||||||
*) check_args '1' '0' 'USER [FORMAT]'
|
shell_list | column -t ;;
|
||||||
esac
|
*) check_args '1' '0' 'USER [FORMAT]'
|
||||||
|
esac
|
||||||
rm -f $tmp_file
|
|
||||||
|
rm -f $tmp_file
|
||||||
#----------------------------------------------------------#
|
|
||||||
# Vesta #
|
#----------------------------------------------------------#
|
||||||
#----------------------------------------------------------#
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
exit
|
|
||||||
|
exit
|
||||||
|
=======
|
||||||
|
#!/bin/bash
|
||||||
|
# info: list system services
|
||||||
|
# options: [FORMAT]
|
||||||
|
#
|
||||||
|
# The function for obtaining the list of configured system services.
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
format=${1-shell}
|
||||||
|
|
||||||
|
# Includes
|
||||||
|
source $VESTA/conf/vesta.conf
|
||||||
|
source $VESTA/func/main.sh
|
||||||
|
|
||||||
|
get_srv_state() {
|
||||||
|
srv=$1
|
||||||
|
proc_name=${2-$1}
|
||||||
|
|
||||||
|
# Check service status
|
||||||
|
/etc/init.d/$srv status > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
state='running'
|
||||||
|
|
||||||
|
# Calculate cpu and memory usage
|
||||||
|
cpu=0
|
||||||
|
mem=0
|
||||||
|
for pid in $(/sbin/pidof $proc_name); do
|
||||||
|
pid_mem=$(pmap -x $pid | tail -n1 | awk '{print $3}')
|
||||||
|
pid_cpu=$(grep "^$pid " $tmp_file | cut -f 2 -d ' ')
|
||||||
|
cpu=$((cpu + pid_cpu))
|
||||||
|
mem=$((mem + pid_mem))
|
||||||
|
done
|
||||||
|
mem=$((mem / 1024))
|
||||||
|
|
||||||
|
# Get pid date
|
||||||
|
if [ ! -z $pid ] && [ -e "/proc/$pid/cmdline" ]; then
|
||||||
|
mtime=$(stat -c "%Y" /proc/$pid/cmdline)
|
||||||
|
rtime=$((ctime - mtime))
|
||||||
|
rtime=$((rtime / 60))
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Service is stopped
|
||||||
|
state='stopped'
|
||||||
|
mem=0
|
||||||
|
cpu=0
|
||||||
|
rtime="0"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Save current proccess list
|
||||||
|
tmp_file=$(mktemp)
|
||||||
|
if [ "$format" = 'json' ]; then
|
||||||
|
ps aux | awk '{print $2" "$3}' | tr -d '.' > $tmp_file
|
||||||
|
else
|
||||||
|
ps aux | awk '{print $2" "$3}' | cut -f 1 -d '.' > $tmp_file
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get current time
|
||||||
|
ctime=$(date +%s)
|
||||||
|
|
||||||
|
# Proxy
|
||||||
|
service=$PROXY_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
get_srv_state $service
|
||||||
|
str="NAME='$service' SYSTEM='reverse proxy' STATE='$state' CPU='$cpu'"
|
||||||
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Web
|
||||||
|
service=$WEB_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
if [ "$service" == 'apache' ]; then
|
||||||
|
service='httpd'
|
||||||
|
fi
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='web server' STATE='$state' CPU='$cpu'"
|
||||||
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# DNS
|
||||||
|
service=$DNS_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
if [ "$service" == 'bind' ]; then
|
||||||
|
service='named'
|
||||||
|
fi
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='dns server' STATE='$state' CPU='$cpu'"
|
||||||
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# MAIL
|
||||||
|
service=$MAIL_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='mail server' STATE='$state' CPU='$cpu'"
|
||||||
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# IMAP
|
||||||
|
service=$IMAP_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='pop/imap server' STATE='$state'"
|
||||||
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ANTIVIRUS
|
||||||
|
service=$ANTIVIRUS_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
if [ "$ANTIVIRUS_SYSTEM" = 'clamav' ]; then
|
||||||
|
service='clamd'
|
||||||
|
fi
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='email antivirus' STATE='$state'"
|
||||||
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ANTISPAM
|
||||||
|
service=$ANTISPAM_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
get_srv_state $service spamd
|
||||||
|
str="$str\nNAME='$service' SYSTEM='email antispam' STATE='$state'"
|
||||||
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# DB
|
||||||
|
service=$DB_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
for db in ${DB_SYSTEM//,/ }; do
|
||||||
|
service="$db"
|
||||||
|
if [ "$service" == 'mysql' ] && [ ! -e "/etc/init.d/$service" ]; then
|
||||||
|
service='mysqld'
|
||||||
|
fi
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='database server' STATE='$state'"
|
||||||
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# FTP
|
||||||
|
service=$FTP_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='ftp server' STATE='$state' CPU='$cpu'"
|
||||||
|
str="$str MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CRON
|
||||||
|
service=$CRON_SYSTEM
|
||||||
|
if [ ! -z "$service" ] && [ "$service" != 'no' ]; then
|
||||||
|
get_srv_state $service
|
||||||
|
str="$str\nNAME='$service' SYSTEM='job scheduler' STATE='$state'"
|
||||||
|
str="$str CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defining config
|
||||||
|
echo -e "$str" > $tmp_file
|
||||||
|
conf=$tmp_file
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields="\$NAME \$SYSTEM \$STATE \$CPU \$MEM \$RTIME"
|
||||||
|
|
||||||
|
# Listing services
|
||||||
|
case $format in
|
||||||
|
json) json_list ;;
|
||||||
|
plain) nohead=1; shell_list ;;
|
||||||
|
shell) fields='$NAME $STATE $CPU $MEM $RTIME'
|
||||||
|
shell_list | column -t ;;
|
||||||
|
*) check_args '1' '0' 'USER [FORMAT]'
|
||||||
|
esac
|
||||||
|
|
||||||
|
rm -f $tmp_file
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
exit
|
||||||
|
>>>>>>> 6bd00c9e5ea0ba53c998291dec65f9d20a9ce49b
|
||||||
|
|
|
@ -67,14 +67,14 @@ function humanize_time($usage) {
|
||||||
$usage = $usage / 60;
|
$usage = $usage / 60;
|
||||||
if ( $usage > 24 ) {
|
if ( $usage > 24 ) {
|
||||||
$usage = $usage / 24;
|
$usage = $usage / 24;
|
||||||
$usage = number_format($usage, 0);
|
$usage = number_format($usage);
|
||||||
if ( $usage == 1 ) {
|
if ( $usage == 1 ) {
|
||||||
$usage = $usage." "._('day');
|
$usage = $usage." "._('day');
|
||||||
} else {
|
} else {
|
||||||
$usage = $usage." "._('days');
|
$usage = $usage." "._('days');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$usage = number_format($usage, 0);
|
$usage = number_format($usage);
|
||||||
if ( $usage == 1 ) {
|
if ( $usage == 1 ) {
|
||||||
$usage = $usage." "._('hour');
|
$usage = $usage." "._('hour');
|
||||||
} else {
|
} else {
|
||||||
|
@ -174,4 +174,4 @@ function display_error_block() {
|
||||||
unset($_SESSION['error_msg']);
|
unset($_SESSION['error_msg']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue