#!/bin/sh
#
#
#    Scalix Public License
#
#
#    The contents of this file are subject to the Scalix Public License
#    Version 1.1 ("License"); you may not use this file except in
#    compliance with the License. You may obtain a copy of the License at
#
# 
#    http://www.scalix.com/community/licensing 
#
# 
#    Software distributed under the License is distributed on an "AS IS"
#    basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
#    the License for the specific language governing rights and limitations
#    under the License.
#
# 
#    The Original Code is Scalix Server. 
#    The Initial Developer of the Original Code is Scalix Corporation. 
#    Copyright (C) 2006 Scalix Corporation. 
#    All Rights Reserved.
#    Additional Copyrights may apply - see the notice in each file
#
#
#
#
#
# 

# Copyright (C) 2006 Scalix Corporation. All rights reserved.
#
################################################################
# This script is used by the Management Services (aka SAC) to
# run system df command to report file system disk space usage
################################################################
#
# parse the arguments 
#
AllOpts=""
while [ $# -ne 0 ]
do
    case "$1" in
        *~/*) # get the real path of the Scalix instance
        file_system=`/opt/scalix/bin/omrealpath $1`
        if [ $? -ne 0 ]
        then
            echo "[SX 501] Failed to obtain Scalix real path for $1"
            exit $?
        fi
        AllOpts="$AllOpts $file_system"
        shift
        ;;
        *) # just copy over, assuming no special characters
        AllOpts="$AllOpts $1";
        shift
        ;;
    esac
done
#
# Execute the command
#
/bin/df $AllOpts
#
# check status. If fails just skip it
#
if [ $? -ne 0 ]
then
    echo "[SX 502] Failed to obtain File System Space Usage"
	exit $?
fi
exit 0
