Mandrill App is the self-service part of MailChimp.
Basically it is a transactional outgoing email server. Mandrill is very cool having these features:
1. Keeps track of all your email sents.
2. Wondering what happen to that email you just sent? Why the recipient never got it? No more of that problem. Mandrill's log will tell you why.
3. First 12,000 emails sent are FREE, and above 12,000 emails are very reasonably priced.
Okay great... those are all great... but setting up Mandrill is a chore. Since it is transactional email, you have to authorize Mandrill's servers to send emails on your behalf. You have to set DKIM and SPF records as TXT records into your DNS Records.
I use NameCheap, because they are cheap and have good support.
Here is a screenshot of what my NameCheap DNS settings looks like:
Once you set those records in your DNS, you should wait about 30 minutes for the records to propagate to other DNS servers worldwide.
Then, go back to your Mandrill admin panel > Settings > Sending Domains and click on the Test DNS Settings button.
If all goes well... you should see something like this:
The tricky / key part here is setting the 'host' of the DKIM to just 'mandrill._domainkey' instead of 'mandrill._domainkey.domain.com' as suggested by Mandrill's instructions.
Wednesday, January 20, 2016
Wednesday, January 13, 2016
Bash shell script to rotate log files in certain directory using array of files
The script below will automatically rotate log files (defined in array) inside certain directory.
Note the Logfiles array in variable $Logfiles.
To use this script simply save the script to filename (you can change this): rotate_logs.sh
Change the values for variables:
Directory
Extension
Logfiles
then make it executable using:
chmod +x rotate_logs.sh
-----------------------------
Directory='/log';
Extension='log';
Logfiles=('file_1' 'file_2' 'file_3');
echo "Directory: ${Directory}";
echo "Extension: ${Extension}";
echo "Logfiles: ${Logfiles}";
for File in "${Logfiles[@]}"
do
cd ${Directory}
echo "Rotating: ${Directory}/${File} ... "
mv ${File}.${Extension} ${File}-`date +%Y%m%d`.${Extension}
touch ${File}.${Extension}
chmod 777 ${File}.${Extension}
done
------------------------------
Once rotate daily / nightly you should also remove old log files using these lines in your cron table:
crontab -e
----------------
40 3 * * * find /log -mtime +5 | xargs rm -f
----------------
The first cron table line '/cron_shell/rotate_logs.sh' is the rotate script I described above.
The second line removes files older than 5 days.
Subscribe to:
Posts (Atom)