So. I had Recoll working fine and Cron launching recollindex every night at 01:15 to update the index. I wanted to have Cron email me to let me know that recollindex had been launched successfully each night. That was easily achieved by adding the following line to the crontab file:
I substituted my real email address for the dummy values shown here of course. That told Cron I wanted it to email me. But for Ubuntu to be able to email out it either needs to be set up as an email server or it needs to be able to authenticate against an existing external email server (like Thunderbird does). I didn’t want to have to configure an email server on my Ubuntu PC just for this, so I hunted round for ways to have it authenticate against an external mail server.
Happily, I found sSmtp. sSmtp is an extremely simple, resource conserving, SMTP server that will allow your PC to do just that. It allows processes in your PC to email out, by authenticating against an external mail server. One of my email accounts is a Google mail (gmail) account. I chose to use the gmail mail server as my external mail server.
To install sSmtp type the following into a terminal window:
sudo apt-get install ssmtp
When it had installed I used gedit to edit the ssmtp.conf file.
I added or edited the following lines:
Of course I used my real gmail email adddress details, username and password.
Then I added each account that I wanted to be able to send mail from by editing the revaliases file.
I added two lines, one for root and one for me.
Again, I used my real gmail email address and my Ubuntu local username.
Now all I had to do was configure gmail to accept POP.
Once I had done that I could test the email throughput by sending an email to one of my other accounts using the following terminal command:
sudo ssmtp firstname.lastname@example.org
Use a real, but different email address than your gmail one.
The message must be formatted in the following way:
Subject: Example Message
and then hit Ctrl-D. Note the blank line following the Subject: to line. Everything after that is the body of the email. Then go and check your other email account and see if the email got there. If there are any immediate issues, you will see an error message in the terminal window.
If everything has gone according to plan, you should receive the email. It all worked, and that meant that Cron would be able to email me when the recollindex program was launched each night. And that is what happened. In the wee wee hours of the morning I got an email from Cron. All 22,000 lines of it! The output from recollindex is verbose, to understate the matter somewhat.
And that’s what brought me to Chronic.
Cron is a daemon in Linux systems that runs processes at specified times. A file contains definitions of times and programs. At the specified time it runs the listed program. I wanted to use Cron to launch the recollindex program for me, once a night at 01:15 in the morning. To put entries into the Cron list, you need to use a program called crontab, which maintains the definitions files (cron tables).
You start crontab like this:
I added the following entry at the bottom of the file:
15 01 * * * recollindex
From left to right the tokens mean minutes hours day_of_month month day_of_week. The asterisks mean unrestricted. So in this example it means run the recollindex program at 01:15 every day, every month. As a test I set the time in the crontab to be a few minutes in the future and used the top command to view the running processes. By watching the process list I could see that the recollindex program was indeed launched and executed at the appropriate time. The system seemed to be working. But how would I know if it had worked every night?
By adding the line:
You can get Cron to email you when processes are complete. But that meant setting up my Ubuntu system so that applications could email out from it via an SMTP server (Simple Mail Transport Protocol).
And that brought me to sSmtp.