hello guys
jwala said 1 year, 2 months ago:
hey guys jus tell me a script that checks the available disc space i’m new to developement so please explain the script too……….
the server am using is centos- 64 bit…….. it is not accessible to you guys
the script must have the df -k command
adamr said 1 year, 2 months ago:
@jwala
You may want to check out this thread I found at:
http://www.unix.com/shell-programming-scripting/27923-frustrating-disk-space-script.html
or use your favorite search engine to find a script. Hopefully other forum users will be able to provide you with some pointers as well.
-Adam
jwala said 1 year, 2 months ago:
thanks adamr……..
will check out the code and will tell you……….
jwala said 1 year, 2 months ago:
Adam one more help from u……
could u jus explain this command am breaking my head since friday
$$ != $(pgrep -f $(basename $0) | head -n 1)
jwala said 1 year, 2 months ago:
It throws the following error :
df: invalid option — b
Try `df –help’ for more information.
is the file size percent
df: invalid option — b
Try `df –help’ for more information.
discspace.sh: line 13: /root/: Is a directory
discspace.sh: line 14: [: -gt: unary operator expected
enough space available
adamr said 1 year, 2 months ago:
@jwala
I’m not very familiar with shell scripts myself. Hopefully other forum users will be able to provide you with some insight. You may also want to try posting your question on a forum like http://www.unix.com/shell-programming-scripting/ that is more geared towards scripting.
-Adam
jwala said 1 year, 2 months ago:
thanks adam
adamtux said 1 year, 2 months ago:
@jwala You can use the command df -k, but I think the command ‘df -hTa’ is better since it outputs it in a much easier to read format!
You could even script something to run in crontab every so often and then pipe it to email so you get a daily report. Something like this…
#!/bin/bash
df -hTa | mail -s subject diskuser@emailaddress.com
jwala said 1 year, 2 months ago:
thanx adamtux…… will check it out and will say…..
Could anyone help me out for this…..
if [ ${check} != "" -a ${check} !="0" ] ; then
this if loop shows too many arguments error
and the part of the code is :
if [ ${check} != "" -a ${check} != "0" ]; then
log_msg “printf $MSG_UPLOAD_PING_INVALID_STATUS ${check}“
while :
do
input
case $INPUT in
y* | Y*)
break 2
;;
n* | N*)
break
;;
*)
continue
;;
esac
done
else
break
fi
fi
jwala said 1 year, 2 months ago:
guys, please help me ou am frustrated by this code
if loop shows en error named “[: too many arguments"
piece of code is here
if [ ${check} != "" -a ${check} != "0" ]; then
log_msg “printf $MSG_UPLOAD_PING_INVALID_STATUS ${check}“
while :
do
input
case $INPUT in
y* | Y*)
break 2
;;
n* | N*)
break
;;
*)
continue
;;
esac
done
else
break
fi
(“$MSG_UPLOAD_PING_INVALID_STATUS ${check}” – this will display their corresponding messages. No need to worry about the $ things)
kq said 1 year, 2 months ago:
@jwala: you need quotes around the ${check} variable substitution to handle the case where it has no value.
jwala said 1 year, 2 months ago:
guys help me out
FILE_SIZE=wc -c "${FILE_PATH}" | awk '{print $1}'
if i execute this command it shows an error as
wc : ???????????????????
could anyone jus help me out?
kq said 1 year, 2 months ago:
@jwala: One of the techniques described here will probably help you: http://tldp.org/LDP/abs/html/commandsub.html
jwala said 1 year, 2 months ago:
thanks kg……. it’s not working…..
I’ve tried like this……
wordcount=wc -c “${FILE_PATH}” | awk ‘{print $1}’
FILE_SIZE=wordcount
0 min expected wait time