Crontab-UI is a Web user interface for managing scheduled jobs on Unix/Linux-based systems. It lets you schedule recurring tasks at specific times using the "cron" service available on most Unix-like operating systems.
The Crontab-UI user interface is a graphical tool that simplifies creating, editing, and deleting cron tasks. It lets users set up tasks at regular intervals, such as hours, days, weeks, or months, and also offers the option to configure advanced cron tasks, such as tasks scheduled on specific days of the week or holidays.
In this article, we will explain how to install and configure it on Ubuntu/Debian with an NGINX reverse proxy to use Certbot to obtain and renew the SSL certificate (as well as a systemd service for crontab-ui).
How to install Node.js, NPM, and Crontab-UI
First, update the repositories and packages:
# apt update && apt upgrade -yAnd install the essential dependencies:
# apt install build-essentialThen use the official Node.js script:
# curl -sL https://deb.nodesource.com/setup_18.x | bash -Next, install Node.js (this also installs NPM):
# apt install -y nodejsAnd use NPM for crontab-ui:
# npm install -g crontab-uiHow to configure a reverse proxy for Crontab-UI
To configure the reverse proxy, first install NGINX:
# apt install nginx -yAnd install the Apache utilities for NGINX auth_basic:
# apt install apache2-utils -yThen use htpasswd to create the file and the crontab user:
# htpasswd -c /etc/nginx/.htpasswd crontabSet your desired password and remember that these will be the credentials for accessing crontab-ui. Then remove the default NGINX configuration:
# rm /etc/nginx/sites-enabled/defaultCreate the file again with an editor:
# nano /etc/nginx/sites-enabled/defaultAnd add the following content to it:
server {
listen 80;
server_name crontab.ejemplo.com;
auth_basic "Acceso restringido";
auth_basic_user_file /etc/nginx/.htpasswd;
location / {
proxy_pass http://localhost:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
For security, change the ownership and permissions of the htpasswd file:
# chown root:www-data /etc/nginx/.htpasswd && chmod 640 /etc/nginx/.htpasswdHow to configure a systemd service for Crontab-UI
Create a crontabui user to run a service for Crontab-UI (without sudo permissions for security):
# adduser crontabuiAssign it ownership of the Crontab-UI directory:
# chown -R crontabui:crontabui /usr/lib/node_modules/crontab-uiThen create the file for the systemd service with an editor:
# nano /etc/systemd/system/crontab-ui.serviceAdd the following content:
[Unit]
Description=Crontab UI
After=network.target
[Service]
ExecStart=/usr/bin/node /usr/bin/crontab-ui
WorkingDirectory=/home/crontabui
Restart=always
User=crontabui
[Install]
WantedBy=multi-user.target
Save your changes and exit the editor. Then enable the service and start it:
# systemctl enable crontab-ui.service && systemctl start crontab-ui.serviceYou can check the service status by running:
# systemctl status crontab-ui.serviceHow to configure an SSL certificate on the reverse proxy
Install Certbot to obtain and configure the certificate:
# apt install python3-certbot-nginx -yAnd run certbot with the record configured in the NGINX configuration:
# certbot --nginx --redirect -d crontab.ejemplo.comOnce you have completed this last step, Crontab-UI will be ready and you can access it using the configured DNS record. A window will appear in your browser for entering the user created using htpasswd.
We hope this article has been helpful. If you have any questions about this or any other issue related to your servers on Clouding, please contact soporte@clouding.io. We're here to help!