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!

Some HUGE news today... BACKUPMON has been officially added to AMTM! :) Many thanks to @thelonelycoder for his consideration adding this tool to the collective! Proud for it to be featured among the other great collection of essentials scripts to allow us to go beyond the capabilities baked into this awesome Asus-Merlin firmware! I hope they are as useful for you as they are to me! :)

1696858493774.png


And a huge shout-out to @Jeffrey Young for sharing his original script, without it none of this would have been possible. Also, tremendous thanks to @visortgw, @Ripshod, @Stephen Harrington, @maghuro, @alan6854321, @Martinski, @Kingp1n and @ColinTaylor for all your testing, suggestions and sample code to make this script a reality. ;) (and anyone else I may have accidentally left off!)
 
Last edited:
Just installed the script and ran into a minor issue; the password I was trying to use contained a special character (something like pa$$word). It wasn't able to mount the SMB share until I manually editted the cfg file to use pa\$\$word
 
Just installed the script and ran into a minor issue; the password I was trying to use contained a special character (something like pa$$word). It wasn't able to mount the SMB share until I manually editted the cfg file to use pa\$\$word
Great catch... yeah, I'm not testing for special characters (as you can see). ;) I'll see if there's a way to automate this more, but have a feeling I'll just make it easier on my self and just make a note that explains this when you type in your password.
 
Great catch... yeah, I'm not testing for special characters (as you can see). ;) I'll see if there's a way to automate this more, but have a feeling I'll just make it easier on my self and just make a note that explains this when you type in your password.
I discovered (and mentioned) this earlier, but i just changed password. Some special characters seem to work and others not...
 
I discovered (and mentioned) this earlier, but i just changed password. Some special characters seem to work and others not...
I'll need to do some research to see which characters require that \ to work right... thanks @visortgw!
 
I'll need to do some research to see which characters require that \ to work right... thanks @visortgw!
The only way around this is to encrypt/decrypt the password with openssl like I do in my email scripts. Escaping chars is an endless cat and mouse game, you‘ll end up escaping escapes just to make the variable valid. Think of " and ' as special chars. See the problem in a variable?

Look at email.mod in amtm, function write_email_config_file.
 
The only way around this is to encrypt/decrypt the password with openssl like I do in my email scripts. Escaping chars is an endless cat and mouse game, you‘ll end up escaping escapes just to make the variable valid. Think of " and ' as special chars. See the problem in a variable?

Look at email.mod in amtm, function write_email_config_file.
Well I can agree with you there... I had a terrible time dealing with the network UNC format right here in BACKUPMON... in the format "\\\\192.168.1.1\\share", jumping through all kinds of hoops to try to keep the formatting intact as it gets assigned to variables, being displayed on screen, or saved back to a config file. It's "working" as-is, but I think it's kludgy and messy. Don't suppose you have a good way of dealing with these, do you? :)
 
On a related note to the above discussion; has anyone else had trouble trying to get this script to access a Windows UNC share where the username has a space in it (Firstname Lastname)? I can't get that to work, but haven't had time to fully test with alternate (share) usernames.
 
On a related note to the above discussion; has anyone else had trouble trying to get this script to access a Windows UNC share where the username has a space in it (Firstname Lastname)? I can't get that to work, but haven't had time to fully test with alternate (share) usernames.
I have not tried that... my usernames don't have spaces, and wouldn't recommended doing so from a best practice standpoint.
 
I'm not a scripting expert but this seems to work
Bash:
read -p "Password: " passwd ; echo $passwd ; passwdenc=`echo $passwd | base64`
echo $passwdenc | base64 -d


Bash:
read -p "Password: " passwd ; echo $passwd ; passwdenc=`echo $passwd | base64`
Password: a&b?c\d/e#%^
a&b?cd/e#%^

echo $passwdenc
YSZiP2NkL2UjJV4K

echo $passwdenc | base64 -d
a&b?cd/e#%^
 
I discovered (and mentioned) this earlier, but i just changed password. Some special characters seem to work and others not...
It all depends if the special character means something to the shell interpreter or not. @Viktor Jaep perhaps close the password in single quotes or get creative with using base 64 encoding??
 
I'm not a scripting expert but this seems to work
Bash:
read -p "Password: " passwd ; echo $passwd ; passwdenc=`echo $passwd | base64`
echo $passwdenc | base64 -d


Bash:
read -p "Password: " passwd ; echo $passwd ; passwdenc=`echo $passwd | base64`
Password: a&b?c\d/e#%^
a&b?cd/e#%^

echo $passwdenc
YSZiP2NkL2UjJV4K

echo $passwdenc | base64 -d
a&b?cd/e#%^

Guess I should have kept reading........ @PeterT already suggested it.
 
Bash:
read -p "Password: " passwd ; echo $passwd ; passwdenc=`echo $passwd | base64`
Password: a&b?c\d/e#%^
a&b?cd/e#%^

echo $passwdenc
YSZiP2NkL2UjJV4K

echo $passwdenc | base64 -d
a&b?cd/e#%^
I haven't been following this thread so perhaps it's not relevant here, but you can use the -r parameter to not treat a backslash as an escape character as seen happening in the example above.

Code:
# read -rp "Password: " passwd ; echo $passwd ; passwdenc=`echo $passwd | base64`
Password: a&b?c\d/e#%^
a&b?c\d/e#%^

# echo $passwdenc | base64 -d
a&b?c\d/e#%^

Code:
   -r        Do not treat a Backslash as an escape character.  The backslash is considered to be part
             of the line. In particular, a backslash-newline pair can not be used as a line continuation.
             Without this option, any backslashes in the input will be discarded.
             You should almost always use the -r option with read.
 
For whatever reason it doesn't backup my EXT drive (SSD via USB adapter).
other than that the backup on my nas was created successfully.

Code:
ASUSWRT-Merlin RT-AX86U 3004.388.4_0


Selection: bk
BACKUPMON v1.22

Normal Backup starting in 10 seconds. Press [S]etup or [X] to override and enter RESTORE mode

Backing up to \\192.168.1.5\backup\router mounted to /tmp/mnt/backups
Backup directory location: /Asus-AX86U
Frequency: Perpetual
Mode: Basic

[Primary Backup Commencing]...

Messages:
STATUS: External Drive (\\192.168.1.5\backup\router) mounted successfully under: /tmp/mnt/backups
STATUS: Daily Backup Directory successfully created.
[: .tar*: unknown operand
STATUS: Finished backing up JFFS to /tmp/mnt/backups/Asus-AX86U/20231011-153241/jffs.tar.gz.
STATUS: Finished backing up NVRAM to /tmp/mnt/backups/Asus-AX86U/20231011-153241/nvram.cfg.
tar: can't open '/tmp/mnt/backups/Asus-AX86U/20231011-153241/': Is a directory
STATUS: Finished backing up EXT Drive to /tmp/mnt/backups/Asus-AX86U/20231011-153241/ .tar.gz.
STATUS: Finished copying backupmon.sh script to /tmp/mnt/backups/Asus-AX86U.
STATUS: Finished copying backupmon.cfg script to /tmp/mnt/backups/Asus-AX86U.
STATUS: Finished copying exclusions.txt script to /tmp/mnt/backups/Asus-AX86U.
STATUS: Finished copying reference nvram.txt extract to /tmp/mnt/backups/Asus-AX86U.
STATUS: Finished copying restoration instructions.txt to /tmp/mnt/backups/Asus-AX86U.
STATUS: Settling for 10 seconds...
STATUS: External Drive (\\192.168.1.5\backup\router) unmounted successfully.
 
I haven't been following this thread so perhaps it's not relevant here, but you can use the -r parameter to not treat a backslash as an escape character as seen happening in the example above.

Code:
# read -rp "Password: " passwd ; echo $passwd ; passwdenc=`echo $passwd | base64`
Password: a&b?c\d/e#%^
a&b?c\d/e#%^

# echo $passwdenc | base64 -d
a&b?c\d/e#%^

Code:
   -r        Do not treat a Backslash as an escape character.  The backslash is considered to be part
             of the line. In particular, a backslash-newline pair can not be used as a line continuation.
             Without this option, any backslashes in the input will be discarded.
             You should almost always use the -r option with read.
Oops. I missed seeing that one character not being preserved.
 
@Strud Does your USB drive have a valid volume label? It looks like it's a space (" ").
I didn't set a label during format, so it's empty.

All references across Amtm to the drive are /tmp/mnt/sda1 and all other scripts I have run just fine.
Is the label required here?
 
I believe a label is vital as that becomes the filename the drive is saved to. You can't have a NULL filename.
 
I did set up the label and now it works, the mount point in Amtm changed as well. I'm yet to see if that didn't break my other scripts.

A suggestion - could the backup use "sda1" or whatever the mount point is in case there's no label set?

Anyway, great work, thank you!
 
I did set up the label and now it works, the mount point in Amtm changed as well. I'm yet to see if that didn't break my other scripts.

A suggestion - could the backup use "sda1" or whatever the mount point is in case there's no label set?

Anyway, great work, thank you!
Thanks @Strud... Glad you got that figured out. I would always recommend giving anything a name if it asks for it. All sorts of things can break if things are named with a null value, or a single space. Just a good best practice for the future. I believe when you format your USB drive with AMTM to assign a swap file to it, that it recommends giving it a name as well.
 

Latest threads

Sign Up For SNBForums Daily Digest

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