# build the command
cmd="chown -Rv $RunUser:$RunUserGroup $ProductDir"
# get the command output both STDERR and STDOUTPUT into a var
Msg=$($cmd 2>&1)
[ $? -eq 0 ] || Exit "ERROR : FATAL : Failed to run the $cmd command with $Msg output!!!"
wlog(){
# check terminal if exists echo
test -t 1 && echo "`date +%Y.%m.%d-%H:%M:%S` [$$] $*"
# check LogFile and
test -z $LogFile || {
echo "`date +%Y.%m.%d-%H:%M:%S` [$$] $*" >> $LogFile
} #eof test
}
# eof function wlog
Exit(){
ExitStatus=0
case $1 in
[0-9]) ExitStatus="$1"; shift 1;;
esac
Msg="$*"
test "$ExitStatus" = "0" || Msg="ERROR: $Msg"
wlog "$Msg"
exit $ExitStatus
}
#eof function Exit
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!