Tag Archives: SIZE

Vsftp upload error

By ment0smintz

Code:

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=002
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
#dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
#xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
#connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
# nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
# async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and ...read more

Source: FULL ARTICLE at The UNIX and Linux Forums

Script returningng 0

By donatas1234

hello i write a script which calculate free space but he always is 0 thats wrong with my script?


getFileSystemPerformanceData()
{

if [ -r /etc/issue ] ; then
if grep -q "Ubuntu" /etc/issue ; then
CMD="df -lP | grep -v "/home" | grep -v "/dev/mapper/VolGroup-lv_root""
elif grep -q "Mageia" /etc/issue; then
CMD="df -lP | sed -e '2d'"
elif grep -q "Fedora" /etc/issue; then
CMD="df -lP | grep -v "/home" | grep -v "/dev/mapper/VolGroup-lv_root""
else
CMD="df -lP"
fi
else
CMD="df -lP"
fi
OUTPUT=`$CMD`
echo "$OUTPUT" |
( # Skip the header-line
read IGNORED
SUM=0
SIZE=0
while read FS SIZE USED AVAIL PCT MOUNTED ; do
SIZE=`echo "$AVAIL 1024" | awk '{print $1/$2}'`
SUM=`echo "$SUM $SIZE" | awk '{print $1 + $2}'`
done
PERFCLASS=LogicalDisk;PERFINSTANCE=$FS;PERFMETRIC='Avail Megabytes';PERFINT=0;PERFSAMP=1;PERFAVG=$SUM;PERFMIN=$PERFAVG;PERFMAX=$PERFAVG;writePerformanceDataXml
)


}

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Size calculation MB to GB

By Daniel Gate

PHP Code:


pcmpath query device |awk 'BEGIN{print "TYPEtDEVICE NAMEtSERIALtSIZEtHOSTNAME"}
/DEVICE/ {
disk=$5
printf "%st", $7
printf "%st", disk
getline; printf "%st", substr($2, length($2)-3)
("bootinfo -s " disk) | getline; printf "%st",$0; sum+=$0
printf "%sn", hostname
} END {print "TOTAL SIZE:", sum}'
hostname=`uname -n`




I have this query working, but it returns SIZE in MB. I want the SIZE output in GB. I tried

HTML Code:

("bootinfo -s " disk)/1024


, but not working.

Please advise.

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

For Loop & SUM

By Daniel Gate

HTML Code:

pcmpath query device |awk 'BEGIN{print "DEVICE NAMEtSERIAL"} /DEVICE NAME/ {printf "%st", $5; getline; print substr($2, length($2)-3)}'


This script returns output like below to pull out “DEVICE NAME SERIAL”.

HTML Code:

......
hdisk28 110B
hdisk29 1112
hdisk30 1115
hdisk31 1116
hdisk32 1128
hdisk33 112D
hdisk34 112E
hdisk35 1147
hdisk36 1148
hdisk37 1149
hdisk38 114A
hdisk39 114B
hdisk40 114C
hdisk41 114D
hdisk42 114E
hdisk43 116B
hdisk44 116C
hdisk45 116D
hdisk46 116E
.....


The script below is to pull out the disk size.

HTML Code:

for disk in `pcmpath query device |awk 'BEGIN{print "DEVICE NAMEtSERIAL"} /DEVICE NAME/ {printf "%st", $5; getline; print substr($2, length($2)-3)}' |awk '{print$1}'`
do
printf "%st" $disk; bootinfo -s $disk
done


But, what I need to have is the sum of hdisks with the output:

HTML Code:


List of the output first:

DEVICE NAME SERIAL SIZE
hdisk28 110B 36864
hdisk29 1112 36864
hdisk30 1115 36864
hdisk31 1116 24576
hdisk32 1116 16384
......

and then add them up as Sub-Total and Grand Total followed by:

DISK SUMMARY in MB
SIZE: 36864 NUMBER OF DISKS: 3 SUB-TOTAL: 110592
SIZE: 24576 NUMBER OF DISKS: 1 SUB-TOTAL: 24576
SIZE: 16384 NUMBER OF DISKS: 1 SUB-TOTAL: 16384
....
GRAND TOTAL ======================== xxxxxxxx


Please let me me know how to get the disk size per each disk size and disk summary (SIZE: NUMBER OF DISKS: SUB-TOTAL & GRAND TOTAL)

Source: FULL ARTICLE at The UNIX and Linux Forums