OLD | NEW |
(Empty) | |
| 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 |
| 9 last_updated="" |
| 10 |
| 11 while IFS= read -r line; do |
| 12 if echo "$line" | grep -q "Updating" || |
| 13 echo "$line" | grep -q "Creating" |
| 14 then |
| 15 last_updated="$line" |
| 16 fi |
| 17 |
| 18 if echo "$line" | grep -q -v "Updating" && |
| 19 echo "$line" | grep -q -v "Creating" && |
| 20 echo "$line" | grep -q -v "Found" && |
| 21 echo "$line" | grep -q -v "#" && |
| 22 echo "$line" | grep -q -v "Synchronizing" && |
| 23 echo "$line" | grep -q -v -F -e "->" |
| 24 then |
| 25 echo $line |
| 26 fi |
| 27 |
| 28 if echo "$line" | grep -q -F -e "->" |
| 29 then |
| 30 echo $last_updated |
| 31 echo $line |
| 32 fi |
| 33 done |
OLD | NEW |