Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

log and logf will tail all logs if no arguments passed

  • Loading branch information...
commit 73923a470a29aca6af4ed31965638827160c7130 1 parent 1aec4ed
@jgallen23 authored
Showing with 13 additions and 15 deletions.
  1. +13 −15 bin/mongroup
View
28 bin/mongroup
@@ -52,8 +52,8 @@ read_config() {
else
NAMES[i]=$n
CMDS[i]=$v
+ ((i++))
fi
- ((i++))
fi
done < $CONFIG
if [ ! -d $PIDS ]; then
@@ -111,21 +111,19 @@ tail_log() {
read_config
local app=$2
local arg=$1
- if [ -z "$app" ]; then
- echo "please pass in name of app"
- else
- for i in ${!NAMES[@]}
- do
- if [ "$app" == ${NAMES[i]} ]; then
- echo "Log for ${NAMES[i]}"
- if [ "$arg" == "logf" ]; then
- tail -f $LOGS/${NAMES[i]}.log
- else
- tail $LOGS/${NAMES[i]}.log
- fi
- fi
- done
+ local log_files=
+ local follow=
+
+ for i in ${!NAMES[@]}
+ do
+ if [ -z "$app" -o "$app" == "${NAMES[i]}" ]; then
+ log_files[i]="$LOGS/${NAMES[i]}.log"
+ fi
+ done
+ if [[ "$arg" == "logf" ]]; then
+ follow="-f"
fi
+ tail -n 30 $follow ${log_files[@]}
}
update() {
Please sign in to comment.
Something went wrong with that request. Please try again.