LinuxTutorial MondayUbuntu

Tutorial: How to backup Bookstack automatically

9th May 2020 — by That IT Guy0


Bookstack doesn’t have a backup functionally by default. This tutorial assumes the following:

  • Your Bookstack is fully setup and you have SSH access to the server it’s on.
  • You have another server/vm/pc/instance/nas/whatever where the backups will live (we’ll call it Backup server from now on) and it runs a flavor of Linux.
  • You have SSH access to the backup server.

Step 1 (Backup Server):

Create a new user (we’ll name it bookstack) with its home directory set to the folder where the backups will live. Take note of the user password as it’s needed for Step 2 (if the folder already exists, do the next step first):

sudo adduser --home /thisiswhere/thebackups/willlive bookstack

If the directory exists already, you can run adduser command with a --no-create-home option appended and set permissions manually:

sudo adduser --no-create-home /thisiswhere/thebackups/willlive bookstack && chown bookstack:bookstack /thisiswhere/thebackups/willlive && chmod 755 /thisiswhere/thebackups/willliveStep 2 (Bookstack Server):

Run the following command to install SSHPASS (this is so the Cronjob we set later on can run the script and not need interaction to specify ssh credentials), create the backup script and edit it (change USER for the actual user folder and USER:USER for permissions).

sudo apt install sshpass -y && cd /home/USER && sudo touch && sudo chown -R USER:USER && sudo nano

Copy the following scrip into the file, edit the ssh PASSWORD (it assumes the user you created on the Backup Server is bookstack), address (BACKUP_SERVER_IP_or_DOMAIN) and the folder structure (/thisiswhere/thebackups/willlive) accordingly, save and exit.



date=$(date +"%d-%m-%Y@%H-%M")

cd /home/USER/

mysqldump -u bookstack bookstack > bookstack_db_backup.sql

sudo tar cvf bookstack_db_bkup_$date.tar.gz bookstack_db_backup.sql

sudo tar cvf bookstack_files_bkup_$date.tar.gz /var/www/bookstack

sshpass -p PASSWORD scp -oStrictHostKeyChecking=no bookstack_db_bkup_* bookstack@BACKUP_SERVER_IP_or_DOMAIN:/thisiswhere/thebackups/willlive

sshpass -p PASSWORD scp -oStrictHostKeyChecking=no bookstack_files_bkup_* bookstack@BACKUP_SERVER_IP_or_DOMAIN:/thisiswhere/thebackups/willlive

rm -rf bookstack_files_bkup_* bookstack_db_bkup_* bookstack_db_backup.sql

Run the following to create and edit the db credentials file for the script automation (change USER for the actual local user):

cd /home/USER && touch .my.cnf && nano .my.cnf

Copy the following scrip into the file, edit the password (WHATEVER_THE_PASSWORD_FOR_THE_BOOKSTACK_DB_IS) accordingly, save and exit.


user = bookstack


Now, create a Cronjob to automate the previous script. Open the Crontab file:

sudo nano /etc/crontab

and add the following line at the end (change USER for the actual local user):

* 12 * * 1 root bash /home/USER/

This line specifies that it’ll do a backup every Monday at midday. You can however set it to whatever you’d like. Here’s a quick reference table:

Post image

So, when the Cron is executed, it will run the script which will do a MySQL database dump and compress it, compress the Bookstack folder and send both to the Backup server. If you want to create an initial backup and not wait for the Cronjob, (to make sure all is OK) run this command (change USER for the actual local user):

cd /home/USER && sudo bash

Final annotations:

  1. Depending on the size of your backups and needs, you could set up a small script on the Backup Server that only keeps files from the last X period (so you don’t end up running out of space).
  2. Depending on your setup, if the backup server is located at home and the Bookstack server isn’t (or the other way around), router settings, port forwarding etc or even dynamic IPs might be an issue. To make things simpler, you could install Logmein Hamachi (free version for 5 devices) on both servers so they both have a permanent, virtual lan ip (and you won’t need to fiddle with settings in routers or anything else).


Qualcomm Atheros Wifi: How to fix it on Linux

26th November 2019 — by That IT Guy0


Unfortunately, it’s a pretty common issue (it seems) for Qualcomm Atheros devices on laptops not working properly under Linux Mint / Ubuntu (and potentially others but this fix is specific for said OSs).

The cause for this issue is power management for Qualcomm Atheros devices. I’m assuming this doesn’t happen for every Qualcomm Atheros device… ever, but I’ve certainly seen it happen on Laptops for the last year or two now (even Kernel 5 doesn’t seem to fix this).

Fortunately, it’s a very simple fix once you know this. Unfortunately, if you don’t know this it’s a bit of rabbit hole of all sorts of tests, diagnostics, sanity checks, etc that can be done with all sorts of Wifi related issues. But since you’re here, hopefully this will solve the issue for you.

Disclosure: If this has just started happening to you on your Qualcomm Atheros device, this will not be the fix for your issue as this issue happens from the word go, it’s not something that works fine for a month and then starts being an issue.

  • First, edit the default-wifi-powersave-on.conf file
sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
  • The file’s second line should indicate: “wifi.powersave = 3“. Change it to 2 and reboot.
  • Once back up, make sure the power management for the wireless device is indeed off by running the following command.

Within the information shown, one line should now read “Power Management:off“. If so, the issue should now be hopefully resolved for you.

Be sure to check out more Linux Mint & Ubuntu related articles here.


Mint themes: How to install them on Ubuntu

19th November 2019 — by That IT Guy0


If you’re like me and use Linux Mint as your everyday desktop OS of choice, you’re used to a certain look (be it XFCE, KDE (for older releases) or most likely, Cinnamon) provided by Mint themes.

At work, I use a Ubuntu Server (with a Mate Desktop) with one single Desktop application (the why, when or how isn’t important here). I have this VM in full screen (on a separate monitor).

I’ve recently started using Mint themes (Mint-Y Dark theme) for Mint and while I like it, the difference between this and the screen next to it is annoyingly obvious. The one Dark theme on Ubuntu Mate desktop is blatantly inferior (in my opinion at least) so, what can we do?

We can install Mint themes on Ubuntu. Please note that I’ve only tested this on Ubuntu 19.04. I have no idea if it’ll work on older versions. So, to do this, follow these steps:

Create a new .sh file and open it:


Copy the following in:

mkdir ~/mint-themes
cd ~/mint-themes
sudo dpkg -i mint-x-icons_1.5.2_all.deb
sudo dpkg -i mint-y-icons/mint-y-icons_1.3.4_all.deb
sudo dpkg -i mint-themes/mint-themes_1.8.2_all.deb
cd .. && sudo rm -rf mint-themes/

Make it executable and run it:

sudo chmod +x
sudo bash

You’ll now be able to find the Mint themes in both areas you’ll need to change them within Ubuntu (“Appearance” and “Window Manager”).

Be sure to check out more Linux Mint & Ubuntu related articles here.