Mastering The Art of Dynamic Email Signatures
Dynamic email signatures increase brand visibility, build brand identity, and boost conversions. Learn how to create and update dynamic email signatures.
Read nowFor some of my Ubuntu Servers (10.04) the Cron jobs did not work or only sporadically executed. I’ve asked around, but none of my friends could explain why this is so. This happened on physical as also on virtual servers. Thus I set out today to finally figure out what caused this. To mention it upfront, I did not find the cause of it, but I got my Cron jobs working again. (and learned a lot along the way)
System Crontab and User Crontab
In the past I always set cron jobs in the /etc/crontab file. This is also the way I’ve used cron in the last couple of years. By switching to Ubuntu server 9.x this worked, but somehow since 10.04 they only worked sporadically. As explained, I don’t know why this is so, but moving those cron jobs into the user (in my case the root account) with “crontab -e” they started working again.
The only difference is that one does not need to pass the user the jobs has to run in with the command, since we edit the user crontab file with “crontab -e”, but everyting else works now as expected.
Getting cron to log
Under Ubuntu logging of any cron action is disabled by default. Since, I wanted to see if my jobs are running and execute successfully I had to enable it. Enabling logging of cron is done in the system default files with:
vim /etc/rsyslog.d/50-default.conf
Uncommenting the ‘#’ before the line that says cron and it will enable logging for cron:
cron.* /var/log/cron.log
and save the file. Now simply reload or restart the rsyslog utility with:
service rsyslog restart
Note: In my case, I had to create the file “/var/log/cron.log” manually in order for cron to write the log.
Enable or preventing cron to send eMails
I guess by default, cron will send eMails on errors or completed actions to the user. In my case, I got a lof of eMails with completed actions and more from cron shortly after. Controlling sending of eMails is done by the global variable ” MAILTO=”” “. One can also direct the output to null for disabling sending of emails.
To disable cron from sending for all jobs:
Add MAILTO=”” to the top of cour crontab file.
To disable sending of eMails for individual jobs:
0 1 5 10 * /path/to/script.sh &> /dev/null
Dynamic email signatures increase brand visibility, build brand identity, and boost conversions. Learn how to create and update dynamic email signatures.
Read nowLooking for an email marketing automation software? This guide shows what to look for. We'll also review the best tools for your online marketing needs.
Read nowUsing customer engagement solutions helps you keep your existing customer base and grow. Here are the top 10 customer engagement solutions for your business.
Read nowEmail management for team inboxes is only effective when used to its full potential. This guide has the 10 best practices for managing your team inboxes.
Read nowEmpower your team and delight your customers.