[GH-ISSUE #1056] Cron-based backup of TRMM with backup rotation. #2592

Closed
opened 2026-03-14 04:42:47 +03:00 by kerem · 20 comments
Owner

Originally created by @fts-tmassey on GitHub (Apr 8, 2022).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1056

I created a very straightforward Bash script to generate TRMM backups via cron, as well as only keep a maximum number of backups. There's nothing very clever in this, but if I can save a few minutes for each new installation, then great.

https://github.com/fts-tmassey/tacticalrmm-cronbackup

Originally created by @fts-tmassey on GitHub (Apr 8, 2022). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1056 I created a very straightforward Bash script to generate TRMM backups via cron, as well as only keep a maximum number of backups. There's nothing very clever in this, but if I can save a few minutes for each new installation, then great. https://github.com/fts-tmassey/tacticalrmm-cronbackup
kerem closed this issue 2026-03-14 04:42:52 +03:00
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

Closing issue.

<!-- gh-comment-id:1092868965 --> @fts-tmassey commented on GitHub (Apr 8, 2022): Closing issue.
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

thanks, maybe a write up on how to implement it or a basic install script would be helpful?

<!-- gh-comment-id:1092881221 --> @dinger1986 commented on GitHub (Apr 8, 2022): thanks, maybe a write up on how to implement it or a basic install script would be helpful?
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

I went ahead and expanded the installation/configuration information in the readme: https://github.com/fts-tmassey/tacticalrmm-cronbackup/blob/main/README.md

It's literally a single file, and it needs to be updated based on what user and path the admin used to install TRMM. Given that TRMM doesn't specify that information, it could be anything. Seeing as building a script to collect and manage that information properly would be longer than the script itself... I'm going to leave it with manual installation.

Besides, if you can install and administer an RMM system that is actively under construction, I really hope you can handle copying a single file and updating a couple of variables... :) But I did expand on the necessary details, with suggested actions: if you follow the doc, you should get a working process.

<!-- gh-comment-id:1092954001 --> @fts-tmassey commented on GitHub (Apr 8, 2022): I went ahead and expanded the installation/configuration information in the readme: https://github.com/fts-tmassey/tacticalrmm-cronbackup/blob/main/README.md It's literally a single file, and it needs to be updated based on what user and path the admin used to install TRMM. Given that TRMM doesn't specify that information, it could be *anything*. Seeing as building a script to collect and manage that information properly would be longer than the script itself... I'm going to leave it with manual installation. Besides, if you can install and administer an RMM system that is actively under construction, I really hope you can handle copying a single file and updating a couple of variables... :) But I did expand on the necessary details, with suggested actions: if you follow the doc, you should get a working process.
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

I went ahead and expanded the installation/configuration information in the readme: https://github.com/fts-tmassey/tacticalrmm-cronbackup/blob/main/README.md

Thanks!

It's literally a single file, and it needs to be updated based on what user and path the admin used to install TRMM. Given that TRMM doesn't specify that information, it could be anything. Seeing as building a script to collect and manage that information properly would be longer than the script itself... I'm going to leave it with manual installation.

Agreed but some wont know how to use it, if it was integrated into a script it would pull all the info, I can always look at that.

Besides, if you can install and administer an RMM system that is actively under construction, I really hope you can handle copying a single file and updating a couple of variables... :) But I did expand on the necessary details, with suggested actions: if you follow the doc, you should get a working process.

Lol you would think everyone running these servers could it, scary sometimes!

<!-- gh-comment-id:1092960417 --> @dinger1986 commented on GitHub (Apr 8, 2022): > I went ahead and expanded the installation/configuration information in the readme: https://github.com/fts-tmassey/tacticalrmm-cronbackup/blob/main/README.md > Thanks! > It's literally a single file, and it needs to be updated based on what user and path the admin used to install TRMM. Given that TRMM doesn't specify that information, it could be _anything_. Seeing as building a script to collect and manage that information properly would be longer than the script itself... I'm going to leave it with manual installation. > Agreed but some wont know how to use it, if it was integrated into a script it would pull all the info, I can always look at that. > Besides, if you can install and administer an RMM system that is actively under construction, I really hope you can handle copying a single file and updating a couple of variables... :) But I did expand on the necessary details, with suggested actions: if you follow the doc, you should get a working process. > Lol you would think everyone running these servers could it, scary sometimes!
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

I just updated my readme to also include how to get the backup.sh script in the first place. In doing so, I put in a link to the TRMM backup doc, and noticed that the included wget (to get the script) points at the old repo. You will likely want to update that for the new repo name. (That's gonna be a lot of ongoing cleanup fun for the team...)

<!-- gh-comment-id:1092972424 --> @fts-tmassey commented on GitHub (Apr 8, 2022): I just updated my readme to also include how to get the backup.sh script in the first place. In doing so, I put in a link to the TRMM backup doc, and noticed that the included wget (to get the script) points at the old repo. You will likely want to update that for the new repo name. (That's gonna be a lot of ongoing cleanup fun for the team...)
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

wget looks right to me, says amidaware?

<!-- gh-comment-id:1092977244 --> @dinger1986 commented on GitHub (Apr 8, 2022): wget looks right to me, says amidaware?
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

image

<!-- gh-comment-id:1092978290 --> @dinger1986 commented on GitHub (Apr 8, 2022): ![image](https://user-images.githubusercontent.com/7244447/162470994-73852967-5c6d-43dd-bce5-0279a82f25e0.png)
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

Not in the doc: https://amidaware.github.io/tacticalrmm/backup/

<!-- gh-comment-id:1092979241 --> @fts-tmassey commented on GitHub (Apr 8, 2022): Not in the doc: https://amidaware.github.io/tacticalrmm/backup/
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

eh ok, were using https://docs.tacticalrmm.com/, wonder wtf the other one is! We will get it sorted

<!-- gh-comment-id:1092981821 --> @dinger1986 commented on GitHub (Apr 8, 2022): eh ok, were using https://docs.tacticalrmm.com/, wonder wtf the other one is! We will get it sorted
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

Ahh, the sin of multiple copies... :) I've updated the readme to point to the docs URL instead.

<!-- gh-comment-id:1092985125 --> @fts-tmassey commented on GitHub (Apr 8, 2022): Ahh, the sin of multiple copies... :) I've updated the readme to point to the docs URL instead.
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

yeah need to sort that out! Thanks for pointing it out

<!-- gh-comment-id:1092999886 --> @dinger1986 commented on GitHub (Apr 8, 2022): yeah need to sort that out! Thanks for pointing it out
Author
Owner

@silversword411 commented on GitHub (Apr 8, 2022):

Looks awesome to me! :)

github.com/amidaware/trmm-awesome@a806d77fd4

<!-- gh-comment-id:1093121873 --> @silversword411 commented on GitHub (Apr 8, 2022): Looks awesome to me! :) https://github.com/amidaware/trmm-awesome/commit/a806d77fd4df253d22b666706e8ee1ad669212e9
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

While rooting around for something else, I found that there's a backup.sh in the /rmm directory. Is this now officially part of the install? If so, two things:

  1. You may want to update the backup documentation and document that, instead of having the user wget one ( https://docs.tacticalrmm.com/backup/ ), and
  2. I will update the backup script to use that path for the script: that's one thing less for the user to configure.

Thanks for the info!

<!-- gh-comment-id:1093351012 --> @fts-tmassey commented on GitHub (Apr 8, 2022): While rooting around for something else, I found that there's a backup.sh in the /rmm directory. Is this now officially part of the install? If so, two things: 1) You may want to update the backup documentation and document that, instead of having the user wget one ( https://docs.tacticalrmm.com/backup/ ), and 2) I will update the backup script to use that path for the script: that's one thing less for the user to configure. Thanks for the info!
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

I'm sure it gets downloaded as the install script grabs the git repo, maybe even updates do as well?

<!-- gh-comment-id:1093363718 --> @dinger1986 commented on GitHub (Apr 8, 2022): I'm sure it gets downloaded as the install script grabs the git repo, maybe even updates do as well?
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

I'm not worried about updates: the backup.sh script takes care of itself. I'm worried about why the doc says to manually download the script, when it's already in /rmm. If its presence in /rmm is an accident, the doc makes sense, and I need to ask the user to do a few extra steps. But if the presence of the script is both intentional and supported, I can remove all that stuff from the process of setting up the script. And if that's the case, the doc should be updated to remove that extraneous stuff, too.

In other words: do the developers "bless" the presence of backup.sh in /rmm?

It makes all the sense in the world for it to be there and to stay there. All I need is someone to tell me that the developers agree with that - and if that's the case, it would be wise to update the doc to reflect this as well.

<!-- gh-comment-id:1093390670 --> @fts-tmassey commented on GitHub (Apr 8, 2022): I'm not worried about updates: the backup.sh script takes care of itself. I'm worried about why the doc says to manually download the script, when it's already in /rmm. If its presence in /rmm is an accident, the doc makes sense, and I need to ask the user to do a few extra steps. But if the presence of the script is both intentional and supported, I can remove all that stuff from the process of setting up the script. And if that's the case, the doc should be updated to remove that extraneous stuff, too. In other words: do the developers "bless" the presence of backup.sh in /rmm? It makes all the sense in the world for it to be there and to stay there. All I need is someone to tell me that the *developers* agree with that - and if that's the case, it would be wise to update the doc to reflect this as well.
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

I guess all that's needed is comparing backup.sh with the current one in the repo and see if they are the same.

I'll check mine and confirm, saves the devs time unless they get back before then lol.

<!-- gh-comment-id:1093392989 --> @dinger1986 commented on GitHub (Apr 8, 2022): I guess all that's needed is comparing backup.sh with the current one in the repo and see if they are the same. I'll check mine and confirm, saves the devs time unless they get back before then lol.
Author
Owner

@fts-tmassey commented on GitHub (Apr 8, 2022):

Again, the problem is not is the script there or is it right. It is there, and it is right. The question is: is it supported? Only the devs can answer that. And why am I asking? Because that directly conflicts with the documentation. If the doc agreed, I wouldn't be asking right now -- but I wouldn't have done it the "wrong" way, either.

I'm not asking for a technical answer: I know it will work today. But is it supported?

And if it is: I suggest updating the doc to avoid this argument in the future! :)

<!-- gh-comment-id:1093393708 --> @fts-tmassey commented on GitHub (Apr 8, 2022): Again, the problem is not is the script there or is it right. It *is* there, and it *is* right. The question is: is it *supported*? Only the devs can answer that. And why am I asking? Because that directly conflicts with the documentation. If the doc agreed, I wouldn't be asking right now -- but I wouldn't have done it the "wrong" way, either. I'm not asking for a technical answer: I *know* it will work today. But is it *supported*? And if it is: I suggest updating the doc to avoid this argument in the future! :)
Author
Owner

@silversword411 commented on GitHub (Apr 8, 2022):

I'm worried about why the doc says to manually download the script,

It says that....because.

So actually the entire /tacticalrmm repo is there as of your last git sync...and update.sh checks to make sure he's updated in case of user craziness...but depending on last git sync as part of update.sh, or something else docs officially just make you explicitly get the right...and latest when doing stuff. I've considered changing docs to use the git managed stuff, but I think there's an occasional problem depending on time/mars alignment/which foot you're standing on at the moment so #BetterSafeThanSorry

<!-- gh-comment-id:1093398429 --> @silversword411 commented on GitHub (Apr 8, 2022): > I'm worried about why the doc says to manually download the script, It says that....because. So actually the entire /tacticalrmm repo is there as of your last git sync...and update.sh checks to make sure he's updated in case of user craziness...but depending on last git sync as part of update.sh, or something else docs officially just make you explicitly get the right...and latest when doing stuff. I've considered changing docs to use the git managed stuff, but I think there's an occasional problem depending on time/mars alignment/which foot you're standing on at the moment so #BetterSafeThanSorry
Author
Owner

@dinger1986 commented on GitHub (Apr 8, 2022):

Yeah so checked (with Wh1te) and it is meant to be there and updates with every update.sh.

In theory when setting up backups you want to check you have the newest backup script it's good practice hence the docs being different.

So docs will stay the same but feel free to point to that one. (Need to chmod +x it)

From a supported point of view it will be there and keep updating so best pointing to that one if its automated with cron really.

<!-- gh-comment-id:1093401459 --> @dinger1986 commented on GitHub (Apr 8, 2022): Yeah so checked (with Wh1te) and it is meant to be there and updates with every update.sh. In theory when setting up backups you want to check you have the newest backup script it's good practice hence the docs being different. So docs will stay the same but feel free to point to that one. (Need to chmod +x it) From a supported point of view it will be there and keep updating so best pointing to that one if its automated with cron really.
Author
Owner

@fts-tmassey commented on GitHub (Apr 11, 2022):

Good enough. Thank you for the information.

For the record, backup.sh (and restore.sh, which I've never touched) are both +x on my install. I kept the +x in my instructions, but it seems it's unnecessary (and if you're gonna make the script an official part of the install, the install should absolutely be responsible for that... but whatever).

I also updated the script to use the owner of backup.sh to run it. So with those two changes, there's no no need for the user to modify the script by default, which is great,

Unless anyone has any suggestions, I'm considering this complete for the moment. Like I said in the readme, I'm too lazy right now to go digging around and figure out how to do the Audit Log and Pending Actions Prune DB Tables action from the command line, but the TRMM doc suggests this should be done periodically and it would be nice to automate. At this time, that's the only thing I'm aware of that might benefit by stuffing into a cron script.

But I'm still way at the beginning of learning about TRMM... :)

<!-- gh-comment-id:1095253767 --> @fts-tmassey commented on GitHub (Apr 11, 2022): Good enough. Thank you for the information. For the record, backup.sh (and restore.sh, which I've never touched) are both +x on my install. I kept the +x in my instructions, but it seems it's unnecessary (and if you're gonna make the script an official part of the install, the *install* should absolutely be responsible for that... but whatever). I also updated the script to use the owner of backup.sh to run it. So with those two changes, there's no no need for the user to modify the script by default, which is great, Unless anyone has any suggestions, I'm considering this complete for the moment. Like I said in the readme, I'm too lazy right now to go digging around and figure out how to do the Audit Log and Pending Actions Prune DB Tables action from the command line, but the TRMM doc suggests this should be done periodically and it would be nice to automate. At this time, that's the only thing I'm aware of that might benefit by stuffing into a cron script. But I'm still way at the beginning of learning about TRMM... :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#2592
No description provided.