Introduction
OnWho backs up...? I back up that’s who... although it is something I didn’t do for a long time. Since I started self-hosting and gathering my own data, I thought that it was about time that I did the responsible thing and do a regular backup. As Yunohosters we are luck in that the platform coes with an, albeit simple, backup solution via the admin panel.
As a backup solution its wayvery soongood as it packages wverything needed for an app or a user and their email into a nice little tar ball, so when you have to restore something is puts everyting back in the right place. Very neat and tidy.
This is a manual process, but you can automate it with a simple cron job, which is what I did.
In terminal on your sever type: crontab -u root -e You need to bve root to so this, so just do an su and type in your password again before running crontab -u root -e. You can the edit the crontab file. Here is mine: (for better of for worse, but it works).
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# CRONJOB TO BACKUP THE YUNOHOST SERVER USING THE
# YUNOHOST BACKUP SERVICE.
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# See the lables on the external drives: "YUNOHOST" is the Yunohost
# backup drive, a good old fashioned 'spinner'.
#
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 1. Backing up the full system to /dev/sdb1 (/media/yunohost/) simlink'ed
# There is a blank .nobackup file in the yunohost.multimedia directory,
# this is to prevent this directorybeing backed up. ALL multimedia files
# are backed up using Restic and Backrest to a 2nd drive called
# "DATARECOVERY"
#
0 0 * * 3,7 yunohost backup create
#
# Full back up will start at MIDNIGHT every WEDNESDAY and SUNDAY.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# 1.1 Other items to back up at other times will be email
#
0 6 * * * yunohost backup create --system data_mail
#
# Email is backed up EVERYDAY at 4 AM
#
# 1.2 More items to be bnacked up include all the system users home folder.
#
0 7 * * * yunohost backup create --system data_home
#
# User home folders backed up every day at 5am
#
#++++++++++++++++++++++ WE ARE DONE HERE...+++++++++++++++++++++++++++++++
Im sure that tere will be some puritans out there that say that there is something wrong woth this. It has worked flawlessly for me for a long time now, bit if there is something wrong with it, then I would like to know. I created a symbolic link to the external drives whic is where my backup tarballs that Yunohost creates are stored. Why? Well disk space mainly but also it gets the backup OFF the server and somewhere safe, if the server fails.
