What's new

BACKUPMON BACKUPMON v1.5.10 -Mar 1, 2024- Backup/Restore your Router: JFFS + NVRAM + External USB Drive! (**Thread closed due to age**)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

This feature gives it that nice, simple SSH rustic feel. No "fancy" colours popping to distract or warn of any pending dooms.
Gives you that "back to the 1960's" flashback kinda vibe... :p
 
- ADDED: Created a secondary commandline switch (-bw) that will launch the script in single color B/W. Thanks to some creative suggestions from @PeterT and an extreme dislike of any form of color within scripts from @ColinTaylor, which helped give me a push in this direction. Instructions: The -bw switch much be used secondarily to any other switch... such as "backupmon.sh -backup -bw", or when using "backupmon.sh -setup -bw". Using a switch like this would allow you to then dump screenwrites to a log file without all the messy color escape characters, and make it much more readable.
One suggestion for the -bw switch: Consider removing the initial control character sequences that clear screen, etc. from the output. Otherwise, they wind up in the output when redirected to a log file.
 
One suggestion for the -bw switch: Consider removing the initial control character sequences that clear screen, etc. from the output. Otherwise, they wind up in the output when redirected to a log file.
have you tried filtering the output which is redirected to the log file? it is possible to remove control characters with sed... e.g. sed -i "s/\x1B\[[0-9;]*[a-zA-Z]//g". my sedcmd may not be suitable for all use cases.
 
Last edited:
One suggestion for the -bw switch: Consider removing the initial control character sequences that clear screen, etc. from the output. Otherwise, they wind up in the output when redirected to a log file.
I might as well make a traditional log file in order to control the output better compared to relying on a redirect from the screen... that would certainly be easier I would think. Unless there's some kind of command out there that I can call via the -bw switch that can override and disable all special control characters from being displayed.

I tried "env TERM=dumb"... but no dice.
 
have you tried filtering the output which is redirected to the log file? it is possible to remove control characters with sed... sed -i "s/\x1B\[[0-9;]*[a-zA-Z]//g"
I have not. I thought that was part of the intent of the -bw switch.
 
I have not. I thought that was part of the intent of the -bw switch.
Partly... the main thing it did was just turn off the colors... It's hard to control anything else. :(
 
Partly... the main thing it did was just turn off the colors... It's hard to control anything else. :(
my previous sed command appears to not be friendly on our routers in its present syntax. Two other possibilities I successfully tested are awk '{gsub(/\x1B\[[0-9;]*[a-zA-Z]/, "");}1' or perl -pe 's/\e\[[0-9;]*[a-zA-Z]//g', but i think perl requires entware.
 
OK... it's really starting to come together now... In fact, while I haven't exactly tested any of the backup scenarios using secondary USB devices or multiple partitions, it would seem that you could perform the following different types of backups:

Router USB Drive -> External network device/share (on your local network)
Router USB Drive -> Local network share (could be mounted to a secondary partition on your USB Drive)
Router USB Drive -> Secondary Router USB Drive (plugged into the secondary USB port)
Router USB Drive -> Router USB Drive (backing up to itself into a separate folder... of course, not recommended, but seems plausible)
Router USB Drive Partition 1 -> Router USB Drive Partition 2 (kinda like the one above, but gives it a little more separation)

I know it was asked before... and if you do go down the path of backing your USB drive to your USB drive, I would definitely recommend using that exceptions.txt file, and try to exclude your backup location from being repeatedly being backed up. The safest way to store backups is far away from the device being backed up... so use at your own risk.

What's new? (here's a rehash of everything in this beta)
v1.32b4 -
- ADDED:
Created a secondary commandline switch (-bw) that will launch the script in single color B/W. Thanks to some creative suggestions from @PeterT and an extreme dislike of any form of color within scripts from @ColinTaylor, which helped give me a push in this direction. Instructions: The -bw switch much be used secondarily to any other switch... such as "backupmon.sh -backup -bw", or when using "backupmon.sh -setup -bw". Using a switch like this would allow you to then dump screenwrites to a log file without all the messy color escape characters, and make it much more readable.
- ADDED: For the capability to distinguish between directly attached USB backup devices, and network backup devices using a new menu item, available in the config menu. (See item #2). When specifying the path to your Backup Target, you will also need to indicate whether it is a "Network" or "USB" target. In the case of a USB Backup Target (directly attached to your router), the script will no longer mount or unmount the device before or after a backup has been completed. By default, "Network" is selected. Thanks much to @Quoc Huynh for the helpful suggestion, and for the extensive testing done by @visortgw!
- FIXED: The order of the config menu items for the primary, secondary and test backup menu items have been optimized. It now starts with determining what type of media the target device is, and using this info, will determine if menu items need to get grayed out. In the case of selecting the USB option, it will also now force the use of @Martinski's excellent mount point selector!
- FIXED: Many verbiage changes in the config menu to help standardize terms.

Download Link:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/BACKUPMON/master/backupmon-1.32b4.sh" -o "/jffs/scripts/backupmon.sh" && chmod 755 "/jffs/scripts/backupmon.sh"
Thank you very much for your passionate work @Viktor Jaep!

I have installed the script, but there maybe a small bug when configuring it 😁 Either selecting option 1 or 6, Backupmon shows a message of ["/jffs/scripts/backupmon.sh: eval: line 1: syntax error: unexpected "(" ] as in attached images. Then it exits automatically.
 

Attachments

  • 1.png
    1.png
    165.8 KB · Views: 35
  • 2.png
    2.png
    150.8 KB · Views: 33
Thank you very much for your passionate work @Viktor Jaep!

I have installed the script, but there maybe a small bug when configuring it 😁 Either selecting option 1 or 6, Backupmon shows a message of ["/jffs/scripts/backupmon.sh: eval: line 1: syntax error: unexpected "(" ] as in attached images. Then it exits automatically.
That's part of the intended function. It's called "exit out" when "error out". You should be happy because @Viktor Jaep saved you from breaking something with his "sh fail safe approach".
 
Thank you very much for your passionate work @Viktor Jaep!

I have installed the script, but there maybe a small bug when configuring it 😁 Either selecting option 1 or 6, Backupmon shows a message of ["/jffs/scripts/backupmon.sh: eval: line 1: syntax error: unexpected "(" ] as in attached images. Then it exits automatically.
Would you please run the following command on your router via SSH and post the output file?
Bash:
mount | grep "/dev/sd.* /tmp/mnt/.*" > $HOME/USB_MountPoints_DEBUG.txt

The error appears to be when looking for the USB drive mount points to build the menu options so I want to see what the router has mounted when the error happens.
 
Would you please run the following command on your router via SSH and post the output file?
Bash:
mount | grep "/dev/sd.* /tmp/mnt/.*" > $HOME/USB_MountPoints_DEBUG.txt

The error appears to be when looking for the USB drive mount points to build the menu options so I want to see what the router has mounted when the error happens.
Thanks @Martinski. Here is the output result:


Code:
/dev/sda1 on /tmp/mnt/Skynet type ext4 (rw,nodev,relatime,data=ordered)
/dev/sdb1 on /tmp/mnt/Backup(1) type ext4 (rw,nodev,relatime,data=ordered)

By the way, my backup USB ext. flash drive used to be labeled "Backup". I have no idea why its name changes to "Backup(1)"

Edited to update: Interestingly, after reformatting and re-labelling the drive as "Backup", there is no more error message, and the output result is:

Code:
/dev/sda1 on /tmp/mnt/Skynet type ext4 (rw,nodev,relatime,data=ordered)
/dev/sdb1 on /tmp/mnt/Backup type ext4 (rw,nodev,relatime,data=ordered)
 

Attachments

  • 3.png
    3.png
    137 KB · Views: 29
  • 4.png
    4.png
    161 KB · Views: 28
Last edited:
Thanks @Martinski. Here is the output result:


Code:
/dev/sda1 on /tmp/mnt/Skynet type ext4 (rw,nodev,relatime,data=ordered)
/dev/sdb1 on /tmp/mnt/Backup(1) type ext4 (rw,nodev,relatime,data=ordered)

By the way, my backup USB ext. flash drive used to be labeled "Backup". I have no idea why its name changes to "Backup(1)"

Edited to update: Interestingly, after reformatting and re-labelling the drive as "Backup", there is no more error message, and the output result is:

Code:
/dev/sda1 on /tmp/mnt/Skynet type ext4 (rw,nodev,relatime,data=ordered)
/dev/sdb1 on /tmp/mnt/Backup type ext4 (rw,nodev,relatime,data=ordered)
Thank you for providing all the info. Now I know where & what the problem is: the parentheses in the volume label "Backup(1)" were throwing up an error in the script "eval" line. I already have a fix for it so I'll be submitting a GitHub PR for @Viktor Jaep to merge into his latest code so we can avoid that type of error in the future.

In the meantime, yes removing the parentheses should avoid the problem.
 
The script work like a charm for me now. Thanks a lot @Viktor Jaep 😊

P/s: May I suggest that option 2 "Backup target media type" should be a prerequisite before changing other options so that future new users may not be confused again? Because if option 6 "Backup target mount point" is selected first, Backupmon only asks me to input the directory path (as shown in picture "A"). On the other hand, if option 2 is selected first, it allows me to choose which drive for target backup (as in picture "B").
 

Attachments

  • 5.png
    5.png
    142.3 KB · Views: 26
  • 6.png
    6.png
    109.9 KB · Views: 23
  • 7a.png
    7a.png
    176.5 KB · Views: 24
  • 8c.png
    8c.png
    165.1 KB · Views: 29
Thank you for providing all the info. Now I know where & what the problem is: the parentheses in the volume label "Backup(1)" were throwing up an error in the script "eval" line. I already have a fix for it so I'll be submitting a GitHub PR for @Viktor Jaep to merge into his latest code so we can avoid that type of error in the future.

In the meantime, yes removing the parentheses should avoid the problem.
You are welcome @Martinski. Thanks for your help too. I really appreciate that!
 
The script work like a charm for me now. Thanks a lot @Viktor Jaep 😊
You're welcome! Huge thanks to @Martinski as well for helping troubleshoot the parentheses problem!
P/s: May I suggest that option 2 "Backup target media type" should be a prerequisite before changing other options so that future new users may not be confused again? Because if option 6 "Backup target mount point" is selected first, Backupmon only asks me to input the directory path (as shown in picture "A"). On the other hand, if option 2 is selected first, it allows me to choose which drive for target backup (as in picture "B").
Well, the intent is for people to go down the list from 1-12. If option 2 is selected for "Network", then the option 6 mount point question is a fill-in-the-blank, because it hasn't been created yet. If you chose USB, then option 6 uses the mount point selector, and lets you choose an already existing USB mount point. Obviously people can skip around in the menu and can practically do anything they want.
 
You're welcome! Huge thanks to @Martinski as well for helping troubleshoot the parentheses problem!

Well, the intent is for people to go down the list from 1-12. If option 2 is selected for "Network", then the option 6 mount point question is a fill-in-the-blank, because it hasn't been created yet. If you chose USB, then option 6 uses the mount point selector, and lets you choose an already existing USB mount point. Obviously people can skip around in the menu and can practically do anything they want.
Yeah, I totally agree with you. He is really talented 😍
Regarding the menu, now I understand your intention. Maybe I should not play around with menu options from now on 😁
 
Thank you for providing all the info. Now I know where & what the problem is: the parentheses in the volume label "Backup(1)" were throwing up an error in the script "eval" line. I already have a fix for it so I'll be submitting a GitHub PR for @Viktor Jaep to merge into his latest code so we can avoid that type of error in the future.

In the meantime, yes removing the parentheses should avoid the problem.
Thanks for this, @Martinski! Your changes were merged with the latest backupmon-1.32b4.sh file. Nice to know that this will no longer be a show stopper for others with unexpected characters in their drive labels. ;)

For you beta testers... Please update your copy of backupmon with this latest version:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/BACKUPMON/master/backupmon-1.32b4.sh" -o "/jffs/scripts/backupmon.sh" && chmod 755 "/jffs/scripts/backupmon.sh"
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top