What's new

Asus Merlin and Cronjob

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

MatteoPV

Senior Member
Hello everyone. I recently started using the VPN-Failover script for managing the possible VPN tunnel crash, the script works great. In order to use it, I added a cronjob in the file / jffs / scripts / post-mount.

I noticed that if I restart the router with the physical button, that is, by disconnecting the power, the command is loaded, if instead I restart from the asus app or from the web, almost never. Why?
 
If post-mount doesn’t run, then the router must not think there is a drive mounted. You would need to compare syslogs of both types of reboots and see where the USB gets detected and post-mount does/does not run.
 
If post-mount doesn’t run, then the router must not think there is a drive mounted. You would need to compare syslogs of both types of reboots and see where the USB gets detected and post-mount does/does not run.
Some addons like skynet, FlexQos etc are always mounted. Others like ScMerlin, SpMerlin etc not always ..... yet they are working.

This happens only if I restart from the web or app ........ if I do the abrupt restart by disconnecting the power, then the restart is perfect
 
Some addons like skynet, FlexQos etc are always mounted. Others like ScMerlin, SpMerlin etc not always ..... yet they are working.

This happens only if I restart from the web or app ........ if I do the abrupt restart by disconnecting the power, then the restart is perfect
i would place your manually added cronjob in services-start
 
Some addons like skynet, FlexQos etc are always mounted. Others like ScMerlin, SpMerlin etc not always ..... yet they are working.

This happens only if I restart from the web or app ........ if I do the abrupt restart by disconnecting the power, then the restart is perfect
I still believe you have to compare the syslog of a hard boot and soft reboot and see where the differences are. Since you’re running Gnuton, there may be some unique oddity with those builds, or with the Asus App.
 
You're right, but in this period I have little time, as soon as possible I'll try to do it. When I installed GNUton I then did a master reset so I think everything is fine
 
I solved. I checked the post-mount file again and moved the VPN_Failover cronjob almost to the beginning ..... but I think this is unimportant. To do these things I use WinSCP, after saving the file, I clicked on the 'update' button, which I didn't do before. I performed 4 web and 4 app restarts, everything loads correctly
 
I still believe you have to compare the syslog of a hard boot and soft reboot and see where the differences are. Since you’re running Gnuton, there may be some unique oddity with those builds, or with the Asus App.
I ask for your opinion on one thing. My router is on 24h because it has always connected an online weather station etc. I have never set automatic restarts, do I have to set them ???
 
I modified the cronjob file to have the command run at set minutes ......... and now it doesn't always load the cronjob at startup. I believe the problem is WinSCP. Is there an alternative to this program ???? I tried FileZilla but it doesn't connect
 
You will need to reboot (ideally, at least twice in the next 10 to 15 minutes). The first time, the JFFS is formatted. The second time, it can be used (without issues).

Anything that was stored in there will need to be reconfigured.

I suggest doing a full reset plus the format instead. Much less work troubleshooting what may go wrong (between what the router thinks has been configured and what the JFFS reality actually is).

Best Practice Update/Setup Router/AiMesh Node(s) 2021

Fully Reset Router and Network

L&LD | SmallNetBuilder Forums
 
Thanks for the reply. I think the problem is somewhere else. If the problem is always present, both with the rough restart, disconnecting the power, and with the app and web restart, ok. But I notice that if I do the rough reboot, everything is fine, if I do it via app or web, not always; that is, the modem is always fine but the cronjob that I have set does not load me. It doesn't load it all the time, sometimes it does, sometimes it doesn't. I don't understand why, I don't think the reset is of any use. I don't want to reset the modem and start from scratch, I have almost all the available AMTM addons on board, it would be a long job
 
The different ways of 'restarting' are not equivalent.

The very fact that there are different outcomes with each method is a sign that the router is not in a good/known state and needs a proper/full reset. Which is the fastest way to a solution, IMO.

I hope you fix these issues 'directly'. But I would have long done an M&M Config since May 31st. :)
 
But this is not the first time this has happened. Weeks ago I tried Unbound and using the VPN I used the scripts found on the forum to pass all DNS requests through the VPN tunnel. Again I had the same problem. Basically everything I install from AMTM etc is fine, but what I add via WinSCP is not always fine. It is as if WinSCP did not have the correct permissions to work with the modem firmware. I then did a master reset and tried Unbound again having the same problems. I then re-did a master reset and eliminated Unbound thinking it was too unstable to use with my setup. Now using VPN-Failover I have the same problem. I'm afraid a master reset is useless as I have already done 3 in the past. Everything works fine if installed by AMTM etc, what I add with WinSCP does not always work.
I set up an auto reboot at 4:01 am via AMTM, the router ran it and loaded everything correctly including my cronjob.
Last week, after doing several tests, I edited the post-mount file several times and in the end everything was fine. I think the problem is some WinSCP setting. I configured it in SCP mode, is there a configuration guide for this program?
 
Last week, after doing several tests, I edited the post-mount file several times and in the end everything was fine.
I think the problem is some WinSCP setting. I configured it in SCP mode, is there a configuration guide for this program?
The Session File Protocol should be SCP, and if you use the default internal editor, then editing post-mount should be fine.

My personal preference is to configure WinSCP to use the feature-rich notepad++ editor, and the only two settings I need to set are shown:

EOL = Unix (LF)
Encoding=UTF-8

1623225452453.png


1623225479877.png


NOTE: You can run your script in debug mode by adding the debugging lines as shown
Code:
#!/bin/sh
set -x
(

<snip body of post-mount script>

) 2>&1 | logger -t $(basename $0)"[$$_***DEBUG]"

so when the script executes during the boot process, it will write its execution messages to Syslog to prove the script physically executed, and if WInSCP is corrupting the script.
 
I have installed NotePad ++ on the PC and configured it as shown above. I checked the post-mount file and then saved. Now even after several restarts everything is loaded correctly, especially the cronjob I entered in order to use VPN_Failover.
 
I had the same problem again and solved it by changing the USB mode of the router from 2.0 to 3.0. With 3.0 it is evidently faster and this type of problem no longer occurs. I wanted to say how I solved it, maybe someone else has the same problem and the argument can be useful
 

Sign Up For SNBForums Daily Digest

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