How do I make this "config backup" cron job work?

hello all

Please can you help me understand someone else’s script and advise me how to get it configured properly?

The end of that thread shows this:

curl --no-progress-meter
-X ‘POST’
‘/api/v2.0/config/save’
-H ‘Authorization: Bearer ’
-H ‘accept: /
-H ‘Content-Type: application/json’
-d ‘{“secretseed”: true}’
–output /$(hostname)-TrueNAS-$(date +%Y%m%d%H%M%S).tar

which I have set as follows, but it doesn’t work because, as is often the case, I don’t understand what this miniature script does:

Here’s “my” version where I have filled in the various parts, almost certainly incorrectly:

curl --no-progress-meter
-X ‘POST’
‘truenas.local/api/v2.0/config/save’
-H ‘Authorization: Bearer abcdefgh12345678’
-H ‘accept: /
-H ‘Content-Type: application/json’
-d ‘{“secretseed”: true}’
–output mnt/mainraid/scripts/$(hostname)-TrueNAS-$(date
+%Y%m%d%H%M%S).tar

and what I get reported to me is

curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: POST
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL

which even I can see means something’s wrong…

Can someone write an example which shows how I should be formatting the script entries for the third line (the URL field) and the last line (the target directory) please?

We automatically back up the config file via cronjob to /var/db/system/configs-<uuid>. You can just download from there and keep a separate copy of your secret seed.

3 Likes

You can use @joeschmuck 's Multi-Report script and this will email you the system config once a week.

Hello and thanks for those replies - Only the other day I installed Multi-Report and chatted to Joe about it. I didn’t realise it could email me the config - excellent!

I see it now in the emails it has already sent me when I was testing it:

TrueNAS Configuration File Emailed every: Mon
Multi Report Configuration File Emailed every: Mon

I hadn’t noticed!

A cronjob to that location seems an interesting option too, which I shall try to read up about. I have a lot to learn with trueNAS which is certainly keeping me entertained!

I see it at

root@truenas[...figs-c329517f97877d06ed58c32b7a2]# ls
TrueNAS-SCALE-22.02.0.1  TrueNAS-SCALE-22.02.4  TrueNAS-SCALE-22.12.2    TrueNAS-SCALE-22.12.4.2  TrueNAS-SCALE-23.10.2  TrueNAS-SCALE-24.04.1.1
TrueNAS-SCALE-22.02.1    TrueNAS-SCALE-22.12.1  TrueNAS-SCALE-22.12.3.3  TrueNAS-SCALE-23.10.1.3  TrueNAS-SCALE-24.04.0  TrueNAS-SCALE-24.04.2

Very handy!

Again - thanks

EB

Just keep in mind, if the pool your backup config is on dies (or your machine gets stolen, burns, whatever), you still don’t have a backup depending on where you put it. You should still have a backup of your pool data also.

I personally store my config backup off site (and locally). As well as some data backups, some of which are offsite.

That is quite alright. I know I need to rewrite the User Guide to be better and in 71 days I should start to have the time I need to do those things.

The configuration file is encrypted by TrueNAS so it is safe to leave in your web based email if you desire. While I keep a local copy, having the email stored copy available is nice too.

It’s a good point regarding the config needing to be available. Luckily, I already rsync to a second NAS (Netgear ReadyNAS) once a week and also to a removable USB HDD which spins down after the backup.

(As an aside, I need to sort out replication next, having just re-configured my snapshots in line with advice from Stux’ latest video regarding “tiering” (which is very good), which I might SSH from my TN to my ReadyNAS).

Along with the emailed version (seeing that it is encrypted by TrueNAS is a major boon - I was searching for that aspect yesterday just before I went to bed!) which I have now set to be sent to me a couple of times a week by Multi-Report, I should be well protected. I have certainly learnt that any problems (so far, they’ve all been self-inflicted) are most rapidly addressed by simply reinstalling Scale most of the time.

It’s very exciting to find out more and more about TrueNAS and the experts who contribute to it and help out; I’m glad to be learning (albeit rather slowly in my case).

I started using TN 2-3y ago but it’s only recently that I have started to fret about data loss, hence these additional precautions and my joining the forums. It is easy to get drawn into a false sense of insecurity when reading a lot of the posts but I always remember that the huge majority of TN users never have anything go wrong and it’s a smaller per centage of enthusiasts who do post. I fall into that latter camp but only to a small degree because I still use TN as a NAS first and foremost (and “app” host which plays second fiddle to that main role) and I don’t do anything too adventurous.

I’m going on and on …

EB

1 Like

Your are on your way then as backups critical! Welcome to the forums and glad you are excited.