1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

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!

Reboot scheduler / corrupts USB drive

Discussion in 'Asuswrt-Merlin' started by kernol, Jan 21, 2019.

  1. kernol

    kernol Regular Contributor

    Joined:
    Feb 24, 2018
    Messages:
    76
    Location:
    South Africa
    Manual webgui "Reboot" button now produces clean reboot even with Diversion 4.0.7_beta installed [the beta adds appropriate code to unmount script] - However, "Reboot Scheduler" has never worked for me and still does not when it come to clean umount of USB drives.

    Surely the solution is for the same code that is called from webgui "Reboot" button to be called by the "Reboot Scheduler" option at the set reboot times? Perhaps @RMerlin can respond?

    I know that AMTM's "Disk Check Script" fixes the USB corruption that occurs after "Reboot Scheduler" is called - but would really prefer a clean scheduled reboot without the data corruption in the first place.
    Many thanks.
     
    slev7n, HuskyHerder and adampk17 like this.
  2. kernol

    kernol Regular Contributor

    Joined:
    Feb 24, 2018
    Messages:
    76
    Location:
    South Africa

    In the absence of any comments to my post [aside from the "likes" - appreciated!] it dawned on me that perhaps the webgui "Reboot" button was part of the closed source section of the stock firmware ... so maybe nobody knows" ??? :(.

    I'm pretty sure that "Scheduled Reboot" was an option first added by Merlin - but it is ages since I was on stock firmware - so can't be sure.
    In the wiki on Merlin - the code for a customised scheduled reboot was last presented in 2015 as a cron job to be placed in /jffs/scripts/init-start.
    That simply invokes a shell "reboot" command.

    The webgui "Reboot" button must be doing more than that - because it certainly graciously umounts the USB's before restarting.
    Perhaps someone can offer a better cron job script for use instead of the "Scheduled reboot" menu option in Merlin-ware [assuming the latter can't be fixed?]
     
    slev7n and HuskyHerder like this.
  3. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,011
    Location:
    Switzerland
    My tests confirm your suspicion that only /jffs/scripts/services-stop is run during the scheduled reboot. /jffs/scripts/unmount is never called.
    This is on a RT-AC1900P with 384.9_alpha2 firmware.

    Edit: I was wrong, both are run, I had a copy paste error.
    Here is the sequence for a scheduled reboot of the two files:
    Code:
    services-stop, Wed Jan 23 18:56:08 MEZ 2019
    unmount, Wed Jan 23 18:56:17 MEZ 2019
    And same sequence for a WebUI reboot:
    Code:
    services-stop, Wed Jan 23 19:02:07 MEZ 2019
    unmount, Wed Jan 23 19:02:11 MEZ 2019
     
    Last edited: Jan 23, 2019
  4. kernol

    kernol Regular Contributor

    Joined:
    Feb 24, 2018
    Messages:
    76
    Location:
    South Africa
    That leaves me wondering why webgui Reboot button works without USB data corruption - but scheduled reboot always end with data corruption ??? Any ideas on where to look to trace the issue?
     
  5. thelonelycoder

    thelonelycoder Part of the Furniture

    Joined:
    Jan 23, 2014
    Messages:
    5,011
    Location:
    Switzerland
    I may have the reason why reboot scheduler is corrupting attached USB file systems.
    When issuing a normal reboot through the WebUI, the time given after the unmount script runs is somewhere in the region of 2 minutes.
    This is vastly different when a scheduled reboot runs, 10 seconds in this test on my RT-AC1900P on 384.9_beta1:
    Code:
    # WebUI reboot
    services-stop, Sun Jan 27 08:55:10 MEZ 2019
    unmount, Sun Jan 27 08:55:13 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 08:55:14 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 08:55:15 MEZ 2019
    ...
    <pings continue in one second steps until final ping at:>
    unmount 1 sec ping, Sun Jan 27 08:57:12 MEZ 2019
    
    # Scheduled reboot
    services-stop, Sun Jan 27 09:02:19 MEZ 2019
    unmount, Sun Jan 27 09:02:28 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:29 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:30 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:31 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:32 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:33 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:34 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:35 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:36 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:37 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:38 MEZ 2019
    unmount 1 sec ping, Sun Jan 27 09:02:39 MEZ 2019
    I have code in /jffs/scripts/unmount and services-stop that log to a file while rebooting. The unmount 1 sec ping writes to the file every second until shutdown of router services kills the task.
     
    slev7n, kernol and HuskyHerder like this.
  6. kernol

    kernol Regular Contributor

    Joined:
    Feb 24, 2018
    Messages:
    76
    Location:
    South Africa
    Many thanks once again ... I believe you know how much I prefer "clean reboots" :) ... hopefully @RMerlin can fix in the final release of 384.9?
    I can't see any harm in increasing the delay time in Scheduled reboot by 2 minutes - after all it is normally run unattended late at night or early in the morning.
     
    slev7n likes this.