Commit 370cb4ba authored by David Gatica's avatar David Gatica

first commit

parents
#!/bin/bash
FILE=$1
rm -rf *.txt
while IFS=':' read AUX zimbraID msgId; do
if [ -f $zimbraID.txt ]
then
echo "ya esta creado $zimbraID.txt"
echo "mms $msgId 0 /Inbox" >> /tmp/resultsSearch/dataParsed/$zimbraID.txt
else
touch /tmp/resultsSearch/filesProv/$zimbraID.txt
echo "mms $msgId 0 /Inbox" >> /tmp/resultsSearch/dataParsed/$zimbraID.txt
fi
done < $FILE
\ No newline at end of file
#!/bin/bash
FILE=$1
rm -rf *.txt
while IFS=':' read AUX zimbraID msgId; do
if [ -f $zimbraID.txt ]
then
echo "ya esta creado $zimbraID.txt"
echo "mms $msgId 1 /Junk" >> /tmp/resultsSearch/dataParsed/$zimbraID.txt
else
touch /tmp/resultsSearch/filesProv/$zimbraID.txt
echo "mms $msgId 1 /Junk" >> /tmp/resultsSearch/dataParsed/$zimbraID.txt
fi
done < $FILE
\ No newline at end of file
#!/bin/bash
files=/tmp/resultsSearch/dataParsed/*.txt
for file in $files
do
# save the id account
idAccount=`echo $file | sed -e 's/\/tmp\/resultsSearch\/dataParsed\// /g'|sed -e 's/.txt//g'`
~/bin/zmmailbox -z -m $idAccount -f $file
done
[mailboxHosts]
mailbox-05.zboxapp.com
- hosts: mailboxHosts
become: yes
become_user: zimbra
tasks:
- name: create file with all domain's accounts
shell: rm -rf /tmp '{{domain}}'.txt
shell: ~/bin/zmprov -l gaa '{{domain}}' > /tmp/'{{domain}}'.txt
tags:
- search
- name: create folder for the search's results
shell: rm -rf /tmp/resultsSearch
file: path=/tmp/resultsSearch state=directory
tags:
- search
- name: create folder for save files .txt that whill contain only zimbraID and msgIds by each mailbox
file: path=/tmp/resultsSearch/dataParsed state=directory
tags:
- search
- name: create script that searches all messages under a criteria on all accounts
shell: rm -rf /tmp/zmmboxsearchAll.prov
shell: cat /tmp/'{{domain}}'.txt | awk '{print "~/bin/zmmboxsearch -m "$0" -q \"'{{query}}'\" -l 9999999 -p 9999999 > /tmp/resultsSearch/"$0".txt "}' > /tmp/zmmboxsearchAll.prov
tag:
- searchDefault
- name: create script that searches all messages under a criteria on all accounts to mark how not spam
shell: cat /tmp/'{{domain}}'.txt | awk '{print "~/bin/zmmboxsearch -m "$0" -q \"'{{query}}' in:Junk\" -l 9999999 -p 9999999 > /tmp/resultsSearch/"$0".txt "}' > /tmp/zmmboxsearchAll.prov
tags:
- searchOnJunk
- name: change permission to execute script
shell: chmod 755 /tmp/zmmboxsearchAll.prov
tags:
- search
- name: execute script for search Data
shell: /tmp/zmmboxsearchAll.prov
tags:
- search
- name: filter only zimbraId and messageId
shell: cat /tmp/resultsSearch/*.txt | grep -v "No results found" | grep ^ID | sed -e 's/ //g' > /tmp/resultsSearch/onlyZimbraIDAndMessageId.txt
tags:
- search
- name: copy script createScriptToMarkHowNotSpam.sh at server
copy: dest=/tmp/resultsSearch/dataParsed src=../files/createScriptToMarkHowNotSpam.sh
tags:
- searchOnJunk
- name: copy script createScriptToMarkHowSpam.sh at server
copy: dest=/tmp/resultsSearch/dataParsed src=../files/markMessagesHowSpam.sh
tags:
- searchDefault
- name: change permission to execute script
shell: chmod 755 /tmp/resultsSearch/dataParsed/createScriptToMarkHowNotSpam.sh
tags:
- searchOnJunk
- name: change permission to execute script
shell: chmod 755 /tmp/resultsSearch/dataParsed/createScriptToMarkHowSpam.sh
tags:
- searchDefault
- name: execute script for create files with the commands zmmailbox to mark how not Spam
shell: /tmp/resultsSearch/dataParsed/markMessagesHowNotSpam.sh /tmp/resultsSearch/onlyZimbraIDAndMessageId.txt
tags:
- searchOnJunk
- name: execute script for create files with the commands zmmailbox to mark how Spam
shell: /tmp/resultsSearch/dataParsed/markMessagesHowSpam.sh /tmp/resultsSearch/onlyZimbraIDAndMessageId.txt
tags:
- searchDefault
- name: copy script executeScriptOnTheMailboxes.sh at server
copy: dest=/tmp/resultsSearch/dataParsed src=../files/executeScriptOnTheMailboxes.sh
tags:
search
- name: change permission to execute script
shell: chmod 755 /tmp/resultsSearch/dataParsed/executeScriptOnTheMailboxes.sh
tags:
- search
- name: execute script that execute all commands zmmailbox generated
shell: /tmp/resultsSearch/dataParsed/executeScriptOnTheMailboxes.sh
tags:
- search
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment