From 6af0d0428d21b8408371cbf2b21758ae5a6969a7 Mon Sep 17 00:00:00 2001 From: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Date: Fri, 19 Mar 2010 10:11:32 -0300 Subject: [PATCH] run-config.sh: Added more call errors check There are only three correct ways to call run.sh: "./run.sh" - No parameters, informing the client to send the availability; "./run.sh --update" - Update option, informing the client to check for updates; "./run.sh --inventory" - Inventory option, informing the client to send the inventory. If run.sh is called with more than one parameter or with an invalid parameter, error messages will be recorded in run.log. Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Acked-by: Diego Giovane Pasqualin <dgp06@c3sl.ufpr.br> Acked-by: Josiney de Souza <josineys@c3sl.ufpr.br> Signed-off-by: Danilo K. S. Yorinori <danilok@c3sl.ufpr.br> --- run-config.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run-config.sh b/run-config.sh index 86f2e63..bc54aa1 100755 --- a/run-config.sh +++ b/run-config.sh @@ -60,8 +60,14 @@ getProxyConf # Timestamp date +"%F %T" >> ${dirname}/run.log + # Execution -if [[ $# == 1 && $1 == "--update" ]]; then +if test $# -gt 1; then + echo "Run.sh call: wrong number of parameters ($#)." >> run.log +elif test $# -eq 0; then + ${bindir}/client ${url} ${inep} ${mac} ${phost} ${pport} ${puid} \ + ${ppasswd} >> ${dirname}/run.log 2>&1 +elif [[ $1 == "--update" ]]; then retstr=$(${bindir}/client $1 ${url} ${inep} ${mac} ${phost} ${pport} \ ${puid} ${ppasswd} 2>> ${dirname}/run.log) retval=$? @@ -71,7 +77,6 @@ elif [[ $1 == "--inventory" ]]; then ${bindir}/client $1 ${url} ${inep} ${mac} ${phost} ${pport} ${puid} \ ${ppasswd} >> ${dirname}/run.log 2>&1 else - ${bindir}/client ${url} ${inep} ${mac} ${phost} ${pport} ${puid} \ - ${ppasswd} >> ${dirname}/run.log 2>&1 + echo "Run.sh call: wrong parameter (\"$1\")." >> run.log fi EOF -- GitLab