What's new

amtm amtm 4.9 - the Asuswrt-Merlin Terminal Menu, June 30, 2024 (locked thread)

  • 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!

I have a shell library script that I wrote & have used for several years to add the "email notification" feature to other custom scripts I have. It uses AMTM email configuration variables to send the email.

The library script can be downloaded from my GitHub repository:
Bash:
mkdir -m 755 -p /jffs/scripts/libs
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused  https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/EMail/CustomEMailFunctions.lib.sh  -o /jffs/scripts/libs/CustomEMailFunctions.lib.sh
chmod 755 /jffs/scripts/libs/CustomEMailFunctions.lib.sh

And here's a sample TEST script showing how to use the above library script:
Bash:
mkdir -m 755 -p /jffs/scripts/libs
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused  https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/EMail/TEST_SendEMailNotification.sh  -o /jffs/scripts/libs/TEST_SendEMailNotification.sh
chmod 755 /jffs/scripts/libs/TEST_SendEMailNotification.sh

As shown in the TEST script, first the email library script is simply sourced in the script that you want to send emails from. The "_SendEMailNotification_()" function is just an example of how to call the library function using the required parameters: the email subject string & the email body file. If you have the AMTM email config already set up, you can just run the TEST script to send a TEST email to check & verify if it works for you.

You can, of course, modify the TEST script to fit your own specific needs, like making it a callable script to send email notifications.

HTH
I'll look into it. As always, I likely do my own implementation that - at best - resembles suggested code.

I seem to have a questionable coding habit as I hear but that's just how my brain works and how I'm comfortable with. Nothing to worry about. And no offense meant if I do it my own way. I did credit you in the a option in amtm, as you might know - for your recent contribution on GitHub :)
 
Good point.
But with a version change I made it a habit to
  • update the website
  • make a full post here
  • change post #1 in this thread
  • change the thread's title
  • post it on reddit in my subreddit https://www.reddit.com/r/diversion/
  • change the signature on this board
  • upload the changes to GitHub https://github.com/decoderman (which I yet have to do for the 4.3 update)
  • and do some housework for the two amtm versions (legacy and firmware versions) to file them locally
I don't do all that with minor updates - I only create your dreaded post in this thread.
You can probably guess what my preliminary decision is - and the reason why.
Oh, and I also update @RMerlin ’s Asuswrt-Merlin wiki page for amtm on GitHub if new addons are supported. In fact, that is next on my list of things to do.
 
I'll look into it. As always, I likely do my own implementation that - at best - resembles suggested code.

I seem to have a questionable coding habit as I hear but that's just how my brain works and how I'm comfortable with. Nothing to worry about. And no offense meant if I do it my own way. I did credit you in the a option in amtm, as you might know - for your recent contribution on GitHub :)

Oh yeah, I get it. I prefer to write my own custom scripts as well, as much as possible and as time allows, using my preferred coding standards & formatting "just the way I like it" :>). So there's no problem at all and no offense is taken. I just provided a possible solution for those who might be interested in trying it.
 
I see
The blame is on you, you were the one that suggested it :)
Not me. "Your Friendly Router" is in the original script from 2012 by, naturally, @RMerlin and posted in the wiki.

Which reminds me, someone should update that post in the wiki about sending email to add in something about amtm. We've graduated to curl, encrypted passwords and mms content along the way. I don't know how to do it.
 
Very polished updates for amtm and Diversion. I hope many people are sending beer/donations to developer(s) of these brilliant firmware and scripts add-ons. Thanks for your hard work @thelonelycoder
Many thanks @Mogsy, appreciate your support.
Let me answer your query from another form of communication here, so all benefit from it.

In the amtm 4.3 release notes I write that:
- amtm feels and is faster in building the list of installed scripts, notably on older routers.

That comes from a code change I made for the modules detection in amtm. That part evaluates if a supported addon is installed or not. Instead of an if-elif-else routine I now use a case statement for the initial lookup. That made it by leaps faster, as stated notably on older routers.

This change was possible because I removed support for legacy scripts such as pixelserv-tls and modified my own scripts to work directly off of the module list variable. Before I had separate code just for these which hampered the swift checks.

For the next update I will be revisiting the swap file code, it is an eyesore to my eyes and over complicated with legacy checks I no longer feel is necessary.
 
I have a shell library script that I wrote & have used for several years to add the "email notification" feature to other custom scripts I have. It uses AMTM email configuration variables to send the email.

The library script can be downloaded from my GitHub repository:
Bash:
mkdir -m 755 -p /jffs/scripts/libs
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused  https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/EMail/CustomEMailFunctions.lib.sh  -o /jffs/scripts/libs/CustomEMailFunctions.lib.sh
chmod 755 /jffs/scripts/libs/CustomEMailFunctions.lib.sh

And here's a sample TEST script showing how to use the above library script:
Bash:
mkdir -m 755 -p /jffs/scripts/libs
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused  https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/EMail/TEST_SendEMailNotification.sh  -o /jffs/scripts/libs/TEST_SendEMailNotification.sh
chmod 755 /jffs/scripts/libs/TEST_SendEMailNotification.sh

As shown in the TEST script, first the email library script is simply sourced in the script that you want to send emails from. The "_SendEMailNotification_()" function is just an example of how to call the library function using the required parameters: the email subject string & the email body file. If you have the AMTM email config already set up, you can just run the TEST script to send a TEST email to check & verify if it works for you.

You can, of course, modify the TEST script to fit your own specific needs, like making it a callable script to send email notifications.

HTH
That is awesome, @Martinski! Thank you so much for sharing!! :)
 
Far be it from me to criticize, but could you please stop doing the "An amtm update is available, no version change" thing.

I'd much rather have 4.3 / 4.3.1 / 4.3.2 etc.
I like to know what I'm running and what the latest available version is.
After thinking long and (maybe not so hard) about your proposal, I agree with you that my minor (patch) update release method is not transparent.

I will now strictly follow the most used versioning system, with the major.minor.patch numbering system.
As a compromise, for a patch release I will only post the reason in this thread, just as I did before.

For all Major or Minor releases I will post to all the mentioned medias.
 
I will now strictly follow the most used versioning system, with the major.minor.patch numbering system.
As a compromise, for a patch release I will only post the reason in this thread, just as I did before.
Sounds sensible to me!

As an aside about version numbers, when I run amtm, I get the following line..

Code:
j3 open     scMerlin      2.4.1     <- 2.4.0

I've got a vague idea that I somehow installed a new version of scMerlin without using amtm and now it's stuck like that. Something to do with it getting CPU temps wrong, but it was a while ago and I'm not sure exactly what I did.

Any idea what to do about it?
 
Sounds sensible to me!

As an aside about version numbers, when I run amtm, I get the following line..

Code:
j3 open     scMerlin      2.4.1     <- 2.4.0

I've got a vague idea that I somehow installed a new version of scMerlin without using amtm and now it's stuck like that. Something to do with it getting CPU temps wrong, but it was a while ago and I'm not sure exactly what I did.

Any idea what to do about it?
That's the development version that addresses temperature reporting for some models such as the GT-AX6000. You could revert by using scmerlin stable from command line, but there is most likely no benefit.
 
Last edited:
Sounds sensible to me!

As an aside about version numbers, when I run amtm, I get the following line..

Code:
j3 open     scMerlin      2.4.1     <- 2.4.0

I've got a vague idea that I somehow installed a new version of scMerlin without using amtm and now it's stuck like that. Something to do with it getting CPU temps wrong, but it was a while ago and I'm not sure exactly what I did.

Any idea what to do about it?
@visortgw gave you the correct answer.
To elaborate, the back version arrow was introduced for developers so they can visually see that they themselves are using their dev version. It also indicates that the release version is higher then the currently installed script version - for whatever reasons ;)
 
After thinking long and (maybe not so hard) about your proposal, I agree with you that my minor (patch) update release method is not transparent.

I will now strictly follow the most used versioning system, with the major.minor.patch numbering system.
As a compromise, for a patch release I will only post the reason in this thread, just as I did before.

For all Major or Minor releases I will post to all the mentioned medias.
I'm following your lead on this... all my scripts will start using this versioning method as well.
 
I'll look into it. As always, I likely do my own implementation that - at best - resembles suggested code.

I seem to have a questionable coding habit as I hear but that's just how my brain works and how I'm comfortable with. Nothing to worry about. And no offense meant if I do it my own way. I did credit you in the a option in amtm, as you might know - for your recent contribution on GitHub :)
@thelonelycoder I would question your coding habits more if you didn't input your own twists. Sometimes it just takes a whisper to spark a coding revolutionary train of thought. Your code wouldn't be the same without your code. I love your work. @Martinski keep it up, You are on FIRE! Great work:cool:.
 
Stupid question about Available Space regarding my Entware USB stick (sdb1, which has a 2.0 GB swap file btw) connected to my router.

amtm shows this:

Code:
ASUS RT-AC68U HW: armv7l Kernel: 2.6.36.4
 FW: 386.12_4 IP address: 192.168.1.1
 Operation Mode: Wireless router
 Thu Feb  8 00:15:08 UTC 2024

 amtm - the Asuswrt-Merlin Terminal Menu

 /mnt/ASUSENTWARE Size 28.4G Used 26.0G (96%)

The essential part: ASUSENTWARE Size 28.4G Used 26.0G (96%)


Merlin GUI (Network map -> click the USB stick - External USB disk status) shows:
Available space: 2.41 GB
Total space: 28.414 GB

No problem. About 2.4 GB free as well.

Command
Code:
df -h
shows:

Code:
TxxxxxxPxxxxxx@RT-AC68U-9AB8:/tmp/home/root# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                32.8M     32.8M         0 100% /
devtmpfs                124.8M         0    124.8M   0% /dev
tmpfs                   124.9M      2.2M    122.6M   2% /tmp
/dev/mtdblock4           62.8M     15.8M     46.9M  25% /jffs
/dev/mtdblock4           62.8M     15.8M     46.9M  25% /www/Advanced_DHCP_Content.asp
/dev/sdb1                28.4G     26.0G    990.7M  96% /tmp/mnt/ASUSENTWARE

The essential part: Available 990.7M.

And if you transfer files to that USB stick for example from Windows 11 PC, it becomes clear that no more than 990.7 megabytes is really available. Not 2.41 GB.

There must be a very simple reason for the difference between these numbers, I mean "Available 990.7M" vs. "Available space 2.41 GB". What's that?

P.S. I am not a very clever guy... as you can see...
 
The library script can be downloaded from my GitHub repository:
Bash:
mkdir -m 755 -p /jffs/scripts/libs
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/EMail/CustomEMailFunctions.lib.sh -o /jffs/scripts/libs/CustomEMailFunctions.lib.sh
chmod 755 /jffs/scripts/libs/CustomEMailFunctions.lib.sh
Hi @Martinski,

I downloaded your Email-sending util, I didn't actually use it, I just cribbed off it and wrote a simple one of my own (I'm a cut&paste script kiddie when it comes to shell scripts!)

BUT there's an error in it you should probably fix..
You use the amtm variable "FROM_NAME", but this doesn't exist.
The correct variable name is "FRIENDLY_ROUTER_NAME"
 
Hi @Martinski,

I downloaded your Email-sending util, I didn't actually use it, I just cribbed off it and wrote a simple one of my own (I'm a cut&paste script kiddie when it comes to shell scripts!)

BUT there's an error in it you should probably fix..
You use the amtm variable "FROM_NAME", but this doesn't exist.
The correct variable name is "FRIENDLY_ROUTER_NAME"
"FROM_NAME" is the sender's email you set in the settings, whereas "FRIENDLY_ROUTER_NAME" is like a nickname. So no error, deliberate. If it was wrong it wouldn't work correctly, would it?
Set it up, send a test email, and see the result.
 
"FROM_NAME" is the variable you set in the settings and not retrieved from the router's settings. So no error, deliberate. If it was wrong it wouldn't work, would it?
Err, OK.
But in amtm / em there's option 4. Edit Router name:
That sets the FRIENDLY_ROUTER_NAME variable.
So where would that get used?
 
Err, OK.
But in amtm / em there's option 4. Edit Router name:
That sets the FRIENDLY_ROUTER_NAME variable.
So where would that get used?
Selection_1.png


IMG_20240208_111406.jpg

I'm not going to mess with my setting to show which one. I'll let you do that.

I may actually have them mixed up. One is the short "AX88U" you see, and the other is the full model name "RT-AX88U" you also see above.
Have a play around and find out for yourself.
 
I went to install RTRMON via AMTM via the RT option. It responded with:

RTRMON requires the Entware repository
installed. Enter ep to install Entware now.

So I entered EP and it found a compatible entware package on my attached USB drive:

Select device to install Entware to

1. /tmp/mnt/xxxxxUSB
Found compatible previous Entware
installation on this device.

Select device [1-1 e=Exit] 1

Running device checks on /tmp/mnt/xxxxxUSB
Device checks passed
_____________________________________________

This device contains a compatible Entware
installation, select what to do.

/tmp/mnt/xxxxxUSB

1. Reuse previous Entware installation.
This requires rebooting this router
after completion.
2. New Entware installation
3. Return to device selection

Enter selection [1-3 e=Exit]

Why does it think I need to install entware when there is already a compatible entware installation found? It doesn't appear I should need to do anything with respect to entware. Or does entware need to exist in a specific location (maybe /OPT/BIN)?
 

Similar 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!
Top