Viktor Jaep
Part of the Furniture
Gives you that "back to the 1960's" flashback kinda vibe...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...This feature gives it that nice, simple SSH rustic feel. No "fancy" colours popping to distract or warn of any pending dooms.
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.- 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.
Yea staying true to the terms vintage and retro. I like how it lacks all that pop art one would expect in the newer "stuff"...Gives you that "back to the 1960's" flashback kinda vibe...
have you tried filtering the output which is redirected to the log file? it is possible to remove control characters with sed... e.g.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.
sed -i "s/\x1B\[[0-9;]*[a-zA-Z]//g"
. my sedcmd may not be suitable for all use cases.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.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 have not. I thought that was part of the intent of the -bw switch.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"
Partly... the main thing it did was just turn off the colors... It's hard to control anything else.I have not. I thought that was part of the intent of the -bw switch.
my previous sed command appears to not be friendly on our routers in its present syntax. Two other possibilities I successfully tested arePartly... the main thing it did was just turn off the colors... It's hard to control anything else.
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.There goes that "back to the 1960's" flashback kinda vibe down the circular filePartly... the main thing it did was just turn off the colors... It's hard to control anything else.
Thank you very much for your passionate work @Viktor Jaep!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"
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?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.
mount | grep "/dev/sd.* /tmp/mnt/.*" > $HOME/USB_MountPoints_DEBUG.txt
Thanks @Martinski. Here is the output result: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.
/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)
/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)
Thanks for your explanation @SomeWhereOverTheRainBow, I did not know about that "secret" However, due to its auto exit, I cannot proceed with the backup function anymoreThat'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 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.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)
You are welcome @Martinski. Thanks for your help too. I really appreciate that!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're welcome! Huge thanks to @Martinski as well for helping troubleshoot the parentheses problem!The script work like a charm for me now. Thanks a lot @Viktor Jaep
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.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").
Yeah, I totally agree with you. He is really talentedYou'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.
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.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.
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"
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!