Thursday, 9 March 2017

Introducing mailing in crontab-ui

Now crontab-ui has option to send mails after execution of jobs along with output and errors attached as text files. This internally uses nodemailer and all the options available through nodemailer are available here.


To change the default transporter and mail config you can modify config/mailconfig.js.
var transporterStr = 'smtps://';

var mailOptions = {
    from: '"Fred Foo 👥" <>', // sender address
    to: ',', // list of receivers
    subject: 'Job Test#21 Executed ✔', // Subject line
    text: 'Test#21 results attached 🐴', // plaintext body
    html: '<b>Test#21 🐴</b> results attached' // html body


Make sure that you have node at /usr/local/bin/node else you need to create a softlink like this
ln -s [location of node] /usr/local/bin/node

Setting up crontab-ui on raspberry pi

In this tutorial I will show you how to setup crontab-ui on raspberry pi.

Step 1

Find your architecture
uname -a
Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
Note that it is ARMv7. Download and extract latest node.
tar xz node-v7.7.2-linux-armv7l.tar.xz
sudo mv node-v7.7.2-linux-armv7l /opt/node

Step 2

Remove old nodejs if it is already installed and add the latest node to the $PATH
sudo apt-get purge nodejs
echo 'export PATH=$PATH:/opt/node/bin' > ~/.bashrc
source ~/.bashrc

Step 3

Install crontab-ui and pm2. And start crontab-ui.
npm install -g crontab-ui
npm install -g pm2
pm2 start crontab-ui
Now your crontab-ui must be running. Visit http://localhost:8000 on your browser to see if it is working.

Step 4 (Optional)

In order to be able access crontab-ui from outside, you have to forward the port 8000. Install nginx and configure.
sudo apt-get install nginx
sudo vi /etc/nginx/sites-available/default
Paste the following lines in the file:
server {
    listen 8001;

    server_name localhost;

    location / {
        proxy_pass http://localhost:8000;
Restart nginx
sudo service nginx restart
Now, crontab-ui must be accessible from outside through port 8001. So, to access crontab-ui, go to
<ip address of pi>:8001
You can also setup http authentication by following this.
Fork me on Github