| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Filter out uninformative output lines from the ldap-sync cron job script | 3 # Filter out uninformative output lines from the ldap-sync cron job script |
| 4 | 4 |
| 5 last_action="" | 5 last_action="" |
| 6 last_updated="" | |
| 7 | 6 |
| 8 while read line; do | 7 while read line; do |
| 9 case "$line" in | 8 case "$line" in |
| 10 *Updating*|*Creating*) | 9 *-\>*) |
|
mathias
2018/06/11 14:10:56
Please make the patterns a bit more specific, in o
| |
| 11 last_updated="$line" | 10 if [ ! -z "$last_action" ] |
| 11 then | |
| 12 echo "$last_action" | |
| 13 fi | |
| 14 | |
| 15 echo "$line" | |
| 16 last_action="" | |
| 12 ;; | 17 ;; |
| 13 *-\>*) | 18 --\ Found\ *\ users* | \ |
| 14 case "$last_action" in | 19 \#* | \ |
|
mathias
2018/06/11 14:10:56
It is not a good idea to base the decision whether
| |
| 15 *-\>*) | 20 *Synchronizing\ *\ groups* | \ |
| 16 echo "$line" | 21 \*\*\ Synchronizing\ *\ users* | \ |
| 17 ;; | 22 --\ Updating\ user\ \'*\'?\(*\)* | \ |
| 18 *) | 23 --\ Updating\ group\ \'*\'* | \ |
| 19 echo "$last_updated" | 24 --\ Creating\ user\ \'*\'?\(*\)* | \ |
| 20 echo "$line" | 25 --\ Creating\ group\ \'*\'*) |
| 21 ;; | 26 last_action="$line" |
| 22 esac | |
| 23 ;; | |
| 24 *Found* | \ | |
| 25 *\#* | \ | |
| 26 *Synchronizing*) | |
| 27 continue | |
| 28 ;; | 27 ;; |
| 29 *) | 28 *) |
| 30 echo "$line" | 29 echo "$line" |
| 31 ;; | 30 ;; |
| 32 esac | 31 esac |
| 33 | |
| 34 last_action="$line" | |
| 35 done | 32 done |
| LEFT | RIGHT |