Skip to content
Snippets Groups Projects
Commit 6af0d042 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Danilo K. S. Yorinori
Browse files

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: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
Acked-by: default avatarDiego Giovane Pasqualin <dgp06@c3sl.ufpr.br>
Acked-by: default avatarJosiney de Souza <josineys@c3sl.ufpr.br>
Signed-off-by: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
parent 6563259c
No related branches found
No related tags found
No related merge requests found
...@@ -60,8 +60,14 @@ getProxyConf ...@@ -60,8 +60,14 @@ getProxyConf
# Timestamp # Timestamp
date +"%F %T" >> ${dirname}/run.log date +"%F %T" >> ${dirname}/run.log
# Execution # 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} \ retstr=$(${bindir}/client $1 ${url} ${inep} ${mac} ${phost} ${pport} \
${puid} ${ppasswd} 2>> ${dirname}/run.log) ${puid} ${ppasswd} 2>> ${dirname}/run.log)
retval=$? retval=$?
...@@ -71,7 +77,6 @@ elif [[ $1 == "--inventory" ]]; then ...@@ -71,7 +77,6 @@ elif [[ $1 == "--inventory" ]]; then
${bindir}/client $1 ${url} ${inep} ${mac} ${phost} ${pport} ${puid} \ ${bindir}/client $1 ${url} ${inep} ${mac} ${phost} ${pport} ${puid} \
${ppasswd} >> ${dirname}/run.log 2>&1 ${ppasswd} >> ${dirname}/run.log 2>&1
else else
${bindir}/client ${url} ${inep} ${mac} ${phost} ${pport} ${puid} \ echo "Run.sh call: wrong parameter (\"$1\")." >> run.log
${ppasswd} >> ${dirname}/run.log 2>&1
fi fi
EOF EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment