Package: pibackup
Who ever has suffered from corrupted SD-cards, even if new and “high quality” - here’s relief.
A scheduledconfigure-once-and-forget-itbackup solution
for smart home systems running on linux base, e.g. Raspberry Pi.
Covered at date are fhem and iobroker. Feel free to request or contribute extensions.Building on the well made pieces of softwarercloneandschedule.Core functions and FeaturesCreate automatic weekly backup of smart home systemTake care of backup hygiene, i.e. keeping reasonable number of backups and delete excessMirroring backups to cloud drive of choice (take what you have, gdrive, dropbox, box, you name it)Install once and forgetRunning as lightweight background processTested on Python >3.5PrerequisitesPython >3.5 with pipUsageFollow four easy steps:Install from PyPiRun the configuration dialogueIf required, customise the config fileReboot and relaxThe steps are described below in more detail.1. Install from PyPi$sudopip3installpibackupIt is encouraged, though not necessary, to install and execute within a virtual environment.
For further information on this, read aboutvirtualenvorvenv.In case you install into a virtual environment, please adapt the crontab entry later, as mentioned in section “On adding the cron job”.2. Run configSimply invoke from the command line:$pibackup-configThis calls a dialogue to set up the system. Essentially, you follow three steps, which are:
- generate a config file (enter s)
- setup rclone (enter c)
- generate a crontab entry to start the process at boot (enter a)The dialogue looks like this.**************************************************pibackup-smarthomebackupsystem**************************************************>>>mains)Setupconfigfileforpibackupc)Configurercloneclouddrivea)Addcronjobatreboottostartbackupq)Quitconfigs/c/a/q>Navigate by entering the respective letter. Start with creating the config file:On setting up the config file**************************************************pibackup-smarthomebackupsystem**************************************************>>>main>>>pibackupconfigfilec)Copyconfigtemplateto~/.config/pibackupq)Quitthispage(goback)c/q>Entering “c” creates a copy of the config file in the home directory.Do this and return to the main screen with “q”.After this, in the main screen, enter “c” to navigate to the rclone setup.On configuring rcloneThis leads straight into the configuration dialogue of rclone itself. As pibackup is a wrapper using rclone, you are now interacting with rclone directly.The tool is very well documentedhere. Please have a peek and check the section related to the backup storage you want to use. Typically remote drives such as Google Drive, Dropbox, Box or OneDrive might be in use at your end and considered for storing the backup. While you can use pretty mucheverything, please find links to popular choices:Google DriveDropboxBoxOneDriveAs mentioned above: Wherever the documentation asks you to run “rclone config”, this is what you are actually doing in the pibackup dialogue already.On adding the cron jobBack in the main dialogue, select “a” to amend the crontab, which adds an entry to start the backup process at every reboot.If you want to double check, do this with:$crontab-lIn case you installed in a virtual environment, please adapt the cron table entry to resemble a format like:@reboot/home/pi/.pibackup-venv/bin/python/home/pi/.pibackup-venv/bin/pibackup&This calls the virtualenv python interpreter and sets the python path accordingly.3. Edit config file for customizationThe config file is located at ~/.conf/pibackup/config.json.It looks like this:{"system":{"type":"fhem"},"rclone":{"drive_name":"drive:","cloud_path":"/backups/fhem/"},"schedules":{"backup_local":"Wednesday","clean_local":"Thursday","cloud_sync":"Sunday"}}The three sections describewhichsystemtype is in usewhich parameters to use forrcloneWhichscheduleto follow for the main tool actionsOn system typeCurrently the systemtypes“fhem” or “iobroker” are supported and can be used as values.On rclone parametersThedrive nameidentifies the remote storage location you created in the rclone setup. Please enter the name you used there. Please include the colon at the end, like “drive:” (in the documentation examples it is often “remote:”)Thecloud pathspecifies the folder on the remote drive. Choose to your liking.On schedulesTypically you can leave this as is. The parameters are pretty verbose:backup_localschedules the weekday on which the smart phone system backups are run.clean_localschedules the weekday on which the local maintenance on the backup folder is being done.cloud_syncschedules the weekday on which the sync to the cloud drive is performed.4. Reboot and feel comfortable…Nice, you did something good for yourself. Congrats and enjoy.MetaPhilipp Cremer -pc01@arcor.deDistributed under the MIT license. SeeLICENSEfor more information.https://github.com/p1ppo/pibackup