Since my recent scare losing a table in MySQL while trying various back-up plug-ins in WordPress I decided to just make my own back-up script in Ubuntu. Eventually I’ll back-up to a local folder, and then rsync from there to some kind of rsync server – maybe I could use a Raspberry Pi 0 in that capacity? (Eventually of course I’ll be looking to use Docker for various images including different WordPress installation but at the moment WordPress is just running on a LAMP/Ubuntu VM hosted by Windows with a handy shared-folder).
Although I’ve used various flavours of Linux on and off for decades, I’ve always been Windows focused and never really spent long enough in terminals in Linux to feel comfortable. This is my first real attempt at putting together some Bash scripts myself (obviously with the continual help of Google lol).
nb: I use WordPress on Windows with IIS and as I have Acronis set-up on there I never worry about back-ups – but am heading towards Docker (mostly linux based) where ever it makes sense in terms of maximising use of hardware, low-energy, and for long-term maintenance and management. (I do admittedly still see “containers” as pets but am forcing myself to see them as “cattle” … it’s painful but necessary).
First of all I looked at copying my simlinks into the cron.daily, cron.weekly and cron.monthly directories or virtual directories or whatever they are but that didn’t get me anywhere – and then I figured the crontab -e route was the way to go (using sudo so that the symlink/regular virtual file would run with the root owner).
Oops – got dom – day of month, and mon – month mixed-up on first attempt.
I believe it should be possible to run c# “script” instead of bash to achieve the same goals. I’ve seen it done using a bash shim that uses mono to compile the code transparently and deal with command line arguments and console output etc. I’ll have to look into doing something similar for .NET Core. It seemed wise to become at least basically familiar with bash so I can better understand others’ solutions to Linux problems (and as I’m beginning to use Linux more and more for low-cost / low-energy distributed-style options). Oh – and of course – Bash now runs on windows! (Still prefer PowerShell so far).