Web server version - getFreeSpace to take these factors into account. The

getFreeSpace to take these factors into account. The modified version looks like the following: getFreeSpace() { if [ $# -lt 1 ] ; then echo “ERROR: Insufficient Arguments.” >&2 return 1 fi DIR=”$1″ if [ ! -d “$DIR” ] ; then DIR= /usr/bin/dirname $DIR fi if isOS HPUX ; then df -b “$DIR” | awk ‘{ print $5 ; }’ else df -k “$DIR” | awk ‘NR != 1 { print $4 ; }’ fi } Here, you are calling the isOS function given earlier in this chapter to determine which commands to execute. Adapting getPID for BSD UNIX Recall the getPID function introduced in Chapter 21: getPID() { if [ $# -lt 1 ] ; then echo “ERROR: Insufficient Arguments.” >&2 return 1 fi PSOPTS=”-ef” /bin/ps $PSOPTS | grep “$1″ | grep -v grep | awk ‘{ print $2; }’ } Remember that it works correctly only on systems where the command ps -ef produces a listing of all running processes. This is not the case on Linux and BSD systems. On BSD systems, we need to use the command ps -auwx to get the correct output. This works on older Linux systems, but on newer Linux systems an error message similar to the following is generated:
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Leave a Reply