Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: edit.sh

Issue 29761555: #8852 - ldap sync output filter (Closed)
Left Patch Set: #8852 - ldap sync output filter Created May 15, 2018, 8:59 a.m.
Right Patch Set: #8852 - ldap sync output filter Created June 20, 2018, 12:32 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | output.txt » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/bin/sh 1 #!/bin/sh
2 #####################################################################
3 #####################################################################
4 ## The cause of this script is to make the output of the LDAP ##
5 ## sync cron job more readable by filtering all repeated lines ##
6 #####################################################################
7 #####################################################################
8 2
9 last_updated="" 3 # Filter out uninformative output lines from the ldap-sync cron job script
10 4
11 while IFS= read -r line; do 5 last_action=""
12 if echo "$line" | grep -q "Updating" ||
13 echo "$line" | grep -q "Creating"
14 then
15 last_updated="$line"
16 fi
17 6
18 if echo "$line" | grep -q -v "Updating" && 7 while read line; do
19 echo "$line" | grep -q -v "Creating" && 8 case "$line" in
20 echo "$line" | grep -q -v "Found" && 9 *-\>*)
21 echo "$line" | grep -q -v "#" && 10 if [ ! -z "$last_action" ]
22 echo "$line" | grep -q -v "Synchronizing" && 11 then
23 echo "$line" | grep -q -v -F -e "->" 12 echo "$last_action"
24 then 13 fi
25 echo $line
26 fi
27 14
28 if echo "$line" | grep -q -F -e "->" 15 echo "$line"
29 then 16 last_action=""
30 echo $last_updated 17 ;;
31 echo $line 18 --\ Found\ *\ users* | \
32 fi 19 \#* | \
20 *Synchronizing\ *\ groups* | \
21 \*\*\ Synchronizing\ *\ users* | \
22 --\ Updating\ user\ \'*\'?\(*\)* | \
23 --\ Updating\ group\ \'*\'* | \
24 --\ Creating\ user\ \'*\'?\(*\)* | \
25 --\ Creating\ group\ \'*\'*)
26 last_action="$line"
27 ;;
28 *)
29 echo "$line"
30 ;;
31 esac
33 done 32 done
LEFTRIGHT
« no previous file | output.txt » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld