@@ -48,8 +48,7 @@ log() {
4848 -w) level=daemon.warn ;;
4949 -e) level=daemon.err ;;
5050 -* )
51- echo " Invalid message level : $level "
52- exit 1
51+ echoerr " Invalid message level : $level "
5352 ;;
5453 esac
5554
@@ -138,7 +137,7 @@ send_data() {
138137 while true ; do
139138 for file in " $TMP_DIR " /* ; do
140139 if [ ! -f " $file " ]; then
141- log -v -i " No data file found to send"
140+ log -i -v " No data file found to send"
142141 trap handle_sigusr1 USR1
143142 # SIGUSR1 signal received, interrupt sleep and continue sending data
144143 sleep " $INTERVAL " &
@@ -171,7 +170,7 @@ send_data() {
171170 # check if agent was already passing or not to avoid repeating log messages
172171 if [ " $FAILING " -eq " 0" ]; then
173172 FAILING=1
174- log -e -n " Data not sent successfully. Response code is \" $response_code \" ." \
173+ [ " $VERBOSE_MODE " -ne " 1 " ] && log -e -n " Data not sent successfully. Response code is \" $response_code \" ." \
175174 " Run with verbose mode to find more."
176175 fi
177176 break
@@ -182,7 +181,7 @@ send_data() {
182181 log -i -v " Data sent successfully"
183182 # check if agent was already failing or not to avoid repeating log messages
184183 if [ " $FAILING " -eq " 1" ]; then
185- log -i -n " Data sent successfully"
184+ [ " $VERBOSE_MODE " -ne " 1 " ] && log -i -n " Data sent successfully"
186185 FAILING=0
187186 rm -f " $RESPONSE_FILE "
188187 fi
@@ -253,8 +252,7 @@ main() {
253252 shift
254253 ;;
255254 -* )
256- echo " Invalid option: $1 "
257- exit 1
255+ echoerr " Invalid option: $1 "
258256 ;;
259257 * ) break ;;
260258 esac
0 commit comments