Background Task Unleashed consists of 2 separate (but cooperating) open source applications:
To use the BTU, you -must- install both applications on the same device that hosts your Frappe web server.
The BTU git branches will stay synchronized with the LTS branches of Frappe Framework. The current support versions are:
version-13
The front-end of BTU is a Frappe web application. It is the command & control center for BTU. From your web browser you will:
You install BTU like any other Frappe web application. You use the Bench CLI application to download, install, and assign to your Sites.
From your Frappe web server, in a terminal:
bench get-app --branch version-13 https://github.com/Datahenge/btu
bench --site your_site_name install-app btu
This is the backend application. It is “always on” Linux daemon that you install on your Frappe web server. The Scheduler is responsible for monitoring the Tasks, placing them into Queues at the correct datetime, and performing some light communication with the Frappe web server and Python RQ.
Unlike Frappe Apps, this Scheduler is a 64-bit Linux binary executable. It does not require Python, JS, Frappe, or any 3rd party libraries or dependencies.
The latest versions can be found on the ‘Releases’ web page. It’s important to choose the correct release for your Linux distribution:
You can save anywhere the binary executable anywhere on your server (especially if you’re comfortable creating symlinks). However, I recommend saving btu_scheduler file somewhere on your PATH. A good place is this directory:
/usr/local/bin/
So, a complete path to the Scheduler would be: /usr/local/bin/btu-scheduler
which btu-scheduler
btu-scheduler --version
After you download and save, execute by opening a terminal and typing:
btu-scheduler
The BTU Scheduler keeps running forever, until you force it to stop. When running in a terminal, just enter CTRL+C
While you “could” just keep BTU Scheduler running all the time in a terminal? It was really designed to be run as a background daemon. There are many ways you can accomplish this, but I recommend using systemd and writing a Systemd Unit File.
/etc/systemd/system/erpnext_rqscheduler.service
Add the following contents:
[Unit]
Description=BTU Scheduler
Wants=network.target
After=syslog.target network-online.target
[Service]
Type=simple
WorkingDirectory=<path_to_your_bench>
ExecStart=/usr/local/bin/btu-scheduler
StandardOutput=/erpnext/v13bench/logs/btu-scheduler.log
StandardError=/erpnext/v13bench/logs/btu-scheduler_error.log
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
Now that you have installed BTU and BTU Scheduler, you must configure them to communicate with each other, and Python RQ.