-
I would like to automatically upload the last backup.tar of the website when uploading the files. Better safe than sorry. Does anyone have an idea where I should start? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Does Publii have keyboard shortcuts to start the backup, for example? |
Beta Was this translation helpful? Give feedback.
-
Your suggestion has inspired me to switch from Windows back to Linux. I’ve created a Bash script to automate the backup of a specific folder (input) from my Publii site and upload it to a remote server. The script monitors another folder (output) for changes and only performs the backup if modifications are detected. Here’s a breakdown of what it does: What the Script Does: The script continuously monitors the /home/USERNAME/Dokumente/Publii/sites/SITENAME/output folder for changes. It checks the folder’s modification timestamp every 60 seconds (configurable). Creates a Backup of the input Folder: If changes in the output folder are detected, the script creates a .tar archive of the input folder. The backup file is named with the site name and the current timestamp (e.g., SITENAME-2023-10-05-15-27-54.tar). Saves the Backup Locally: The .tar file is saved in the /home/USERNAME/Dokumente/Publii/backups directory. Uploads the Backup to a Remote Server: The script uses scp to upload the .tar file to a remote server. The backup is saved in the /REMOTE_DIR/backup directory on the remote server. Runs Continuously: The script runs in an infinite loop, monitoring the output folder and performing backups of the input folder as needed. To Run the Script in the Background: |
Beta Was this translation helpful? Give feedback.
@Hariko50 Publii is no backup software. As a workaround you could create a script for starting Publii and include a command similar to this. (I'm assuming Linux here.)
tar -cf SITENAME-$(date +%Y-%m-%d-%H-%M-%S).tar -C /home/USERNAME/Dokumente/Publii/sites/SITENAME input
(You have to modify SITENAME & USERNAME to match your system. 'Dokumente' maybe too.)
This will create a timestamped .tar file to the current folder.