Most Powerful Open Source ERP

How To Add Regular Backup Function

How To Add a Matomo Configuration file to run Apache webrunner
  • Last Update:2023-01-31
  • Version:001
  • Language:en

Agenda

  1. Add a cron section in file "matomo-instance.cfg.in"
  2. Add the section into "part-list"
  3. Checkout output file

This tutorial will teach you how to make the backup function we wrote before become a function that executes periodically

Prerequisites

Add a cron section in file "matomo-instance.cfg.in"

The crond daemon is the background service of linux that enables cron functionality, witch means doing some tasks regularly, and for adding a cron task in slapos, we can use a function in cookbook slapos.cookbook:cron.d
[matomo-backup-cron]
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = matomo-backup
frequency = 0 0 * * *
command = ${matomo-backup.sh:rendered}

Add the section into "part-list"

Add "matomo-backup-cron" into variable "part-list" like we did before
[custom-application-deployment] 
... 
part-list = matomo-backup.sh matomo-backup-cron

Checkout output file

Run the command in terminal to rebuild

cd ~/srv/project/slapos/software/matomo
../../update-hash
slapos node software --all
slapos node instance --all
Now you can find a file named "matomo-backup" in path 
~/srv/project/runnner/slappartX/etc/cron.d/

You can use linux command find to check if cron output file exist:

find ~/srv/project/runner/ -name matomo-backup
Normally, you will get the result like this:
/srv/slapgrid/slappart9/srv/project/runner/instance/slappart2/etc/cron.d/matomo-backup