Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Filtering out uninformative output lines from the ldap-sync cron job script | 3 # Filter out uninformative output lines from the ldap-sync cron job script |
f.lopez
2018/05/29 21:18:48
I don't think this script is only for cron jobs, e
| |
4 | 4 |
5 last_updated="" | 5 last_action="" |
6 | 6 |
7 while read line; do | 7 while read line; do |
8 case "$line" in | |
9 *-\>*) | |
10 if [ ! -z "$last_action" ] | |
11 then | |
12 echo "$last_action" | |
13 fi | |
8 | 14 |
f.lopez
2018/05/29 21:18:49
be consistent here, either always use a blank line
| |
9 case $line in | 15 echo "$line" |
10 | 16 last_action="" |
f.lopez
2018/05/29 21:18:48
not blank lines here either
| |
11 *Updating*|*Creating*) | |
12 last_updated="$line" | |
13 ;; | 17 ;; |
14 | 18 --\ Found\ *\ users* | \ |
f.lopez
2018/05/29 21:18:48
not blank lines between each option either
| |
15 *-\>*) | 19 \#* | \ |
16 echo $last_updated | 20 *Synchronizing\ *\ groups* | \ |
f.lopez
2018/05/29 21:18:48
this is a regression, I mentioned in the first cod
| |
17 echo $line | 21 \*\*\ Synchronizing\ *\ users* | \ |
22 --\ Updating\ user\ \'*\'?\(*\)* | \ | |
23 --\ Updating\ group\ \'*\'* | \ | |
24 --\ Creating\ user\ \'*\'?\(*\)* | \ | |
25 --\ Creating\ group\ \'*\'*) | |
26 last_action="$line" | |
18 ;; | 27 ;; |
19 | |
20 *Found*|*\#*|*Synchronizing*) | |
f.lopez
2018/05/29 21:18:48
We always avoid modifying unrelated changes, in th
| |
21 continue | |
22 ;; | |
23 | |
24 *) | 28 *) |
25 echo $line | 29 echo "$line" |
26 ;; | 30 ;; |
27 esac | 31 esac |
28 done | 32 done |
LEFT | RIGHT |