What's new

Crontab jobs disappeared.

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

Great work @dave14305. How about putting a logger command near the very beginning? The reason being we saw in some of the output that cru appeared to be hanging on the nvram get http_username command. Putting a logger before that might show cru commands that started and then hung.
OK, pushed an update to github. The first logged line will just list all the args since we don't know if it's an add, delete or list at the beginning.
 
I too have been looking into this issue. Has something changed concerning what triggers post-mount? My isp reboots the cable modem a lot and when it’s an event where it takes a long time to come back online and functional - I lose cron jobs. I thought post-mount was being run after that type wan event.
 
I enjoyed reading @dave14305 and @Martinski works. Definitely master's at work, truely inspiring! I just got home from work.
Welp, here is my stab at a wrapper or improved cru:
Bash:
#!/bin/sh

# Logging function
log() {
    logger -t "cru[$$]" "$1"
}

# Get parent process information
get_parent_info() {
    local PPID=$(grep ^PPid: /proc/$$/status | awk '{ print $NF }')
    local PCMD=$(cat /proc/$PPID/cmdline)
    log "Calling PID: $PPID, CMD: $PCMD"
}

# Lock and unlock function
lock() {
    local lock_file="/var/lock/cron.lock"
    if [ "$1" = "lock" ]; then
        local retry=30
        while [ -f "$lock_file" ] && [ "$retry" -gt 0 ]; do
            sleep 1
            retry=$((retry-1))
        done
        if [ "$retry" -eq 0 ]; then
            log "Failed to acquire lock"
            exit 1
        fi
        touch "$lock_file"
    elif [ "$1" = "unlock" ]; then
        rm -f "$lock_file"
    fi
}

# Main function to add/delete cron jobs
main() {
    local action="$1"
    local username=$(nvram get http_username)
    local cron_file="/var/spool/cron/crontabs/$username"
    case "$action" in
        a)
            lock lock
            shift
            local id="$1"
            local cron_command="${*:2}"
     
            # Add or update the cron job
            grep -v "#$id#$" "$cron_file" >"$cron_file.new"
            echo "$cron_command #$id#" >>"$cron_file.new"
            mv "$cron_file.new" "$cron_file"
            log "Added/Updated cron job with ID: $id"
            lock unlock
            ;;
        d)
            lock lock
            local id="$2"
     
            # Remove the cron job
            grep -v "#$id#$" "$cron_file" >"$cron_file.new"
            mv "$cron_file.new" "$cron_file"
            log "Deleted cron job with ID: $id"
            lock unlock
            ;;
        l)
            cat "$cron_file" 2>/dev/null
            ;;
        *)
            usage
            exit 1
            ;;
    esac
}

# Function to display usage
usage() {
    cat <<END

Cron Utility
add:    cru a <unique id> <"min hour day month week command">
delete: cru d <unique id>
list:   cru l

END
}

# Entry point
if [ "$#" -lt 1 ]; then
    usage
    exit 1
fi

log "Args: $*"
get_parent_info
main "$@"

To make executable and mount:
Code:
chmod 755 /jffs/addons/cru
mount -o bind /jffs/addons/cru /usr/sbin/cru

To remove if you don't like:
Code:
umount /usr/sbin/cru
rm /jffs/addons/cru
 
Last edited:
I'm very curious to see when the problem with "disappearing cron jobs" happens so I wrote a script to take a snapshot of the cron job list at a given frequency, specified in minutes. The script is available on GitHub if you want to try it:
Bash:
mkdir -m 755 -p /jffs/scripts
curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused  https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/Cron/MonitorCronJobList.sh  -o /jffs/scripts/MonitorCronJobList.sh
chmod 755 /jffs/scripts/MonitorCronJobList.sh
I got a request to send email notifications from the "MonitorCronJobList.sh" script when the number of cron jobs changes between 2 consecutive checks so there's a new updated version in GitHub. The emails are a way to get alerted right away when a change WRT the cron job list has been detected so you can verify whether the change is valid & expected.

Note that if you don't have the AMTM email config file set up, and don't want or care to get email notifications, the script will continue to work as before, so the feature is optional and not required at all.

FYI.
 
I enjoyed reading @dave14305 and @Martinski works. Definitely master's at work, truely inspiring! I just got home from work.
Welp, here is my stab at a wrapper or improved cru:
Casually scanning that it looks nice, but I've got to say I've never understood creating a function and then only calling it once. If it's called at least possibly twice and it's involved-enough, yeah, sure. Beyond that I prefer function names which are obviously function calls, and not possibly some native command. Debian is hell about all that...
 
Beyond that I prefer function names which are obviously function calls, and not possibly some native command. Debian is hell about all that...
I agree with you there. That's why you commonly see words that would not commonly be used to call process in the wild being used to call a function. I know @Martinski meshes his words and letter choices together with a mixture of capitals and lowercase to combat this possibility. Another way of doing it is using logical words that would not typically be word choices to call a process, but have a distinctive logic for functions in your script.

Casually scanning that it looks nice, but I've got to say I've never understood creating a function and then only calling it once. If it's called at least possibly twice and it's involved-enough, yeah, sure.
As for creating a function, it is typically useful if you are trying to control readability and controllability of the script in question. Sometimes it can be used just for one or the other. Other times it is done to strike a balance between the two. Despite the main set of commands only being called once, in this instance functions were used to strike a balance between both.
 
Last edited:
I too have been looking into this issue. Has something changed concerning what triggers post-mount? My isp reboots the cable modem a lot and when it’s an event where it takes a long time to come back online and functional - I lose cron jobs. I thought post-mount was being run after that type wan event.
That's a good observation. While it appears no-one has responded I'm sure it's something they will be considering. In my case though I don't have the disconnects so there may be more than one mechanism in play here.
 
As for creating a function, it is typically useful if you are trying to control readability and controllability of the script in question. Sometimes it can be used just for one or the other. Other times it is done to strike a balance between the two. Despite the main set of commands only being called once, in this instance functions were used to strike a balance between both.
I respectfully disagree. Readability is /hampered/ by declaring a function for a single use later (and not ending the name with an underscore, or such). And in such a case there is no controllability difference whatsoever. Reading the code is like trying to follow a pre-quoted-material reply, which is, IMO, just about the stupidest way to do it. One has to scroll to the end, then back up to the start of the section, read through it, then scan backwards, read, repeat. It pains me to say it almost as much as to do it...

I call functions-for-everything obfuscation for the writer's sake, whereby it's easier to maintain (questionably so) by not having to drill down into the script to find a routine to alter. I guess I think it's just a bad habit.
 
I'm very curious to see when the problem with "disappearing cron jobs" happens so I wrote a script to take a snapshot of the cron job list at a given frequency, specified in minutes. The script is available on GitHub if you want to try it:

Weird results. After I managed to stabilize AC86u to avoid crash rebooting, with this script it did it 3 times today (!) Post one of the crashes, all cron jobs came back (27), then disappeared after another one, and got back to (22) only. The scheduled reboot in the morning at 4:05 got 20 jobs first, then in half hour it got to 22. Will probably take the script out for tomorrow's reboot, let' the router catch a breath :)

Code:
Number of Cron Jobs: [22]
2024-Feb-07, 08:37:10 AM UTC (Wed)
Number of Cron Jobs: [22]
2024-Feb-07, 08:40:36 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:42:37 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:44:38 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:46:38 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:48:39 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:50:40 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:52:41 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:54:42 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:56:43 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:58:44 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:00:45 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:02:46 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:04:48 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:06:49 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:08:51 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:10:52 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:12:54 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:14:55 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:16:56 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:18:58 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:20:59 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:23:00 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:25:00 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:27:01 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:29:02 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:31:03 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:33:04 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:35:05 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:37:06 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:39:06 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:41:07 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:43:08 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:45:09 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:47:10 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:49:11 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:51:13 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:53:14 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:55:16 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:57:17 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:59:19 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:01:20 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:03:22 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:05:23 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:07:25 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:09:26 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:11:28 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:13:29 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:15:30 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:17:32 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:19:32 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:21:33 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:23:34 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:25:35 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:27:36 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:29:36 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 04:37:05 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:39:06 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:41:08 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:43:09 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:45:11 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:47:12 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:49:14 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:51:14 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:53:15 PM UTC (Wed)
Number of Cron Jobs: [22]
2024-Feb-07, 04:55:16 PM UTC (Wed)
Number of Cron Jobs: [22]
2024-Feb-07, 04:57:17 PM UTC (Wed)
Number of Cron Jobs: [22]

Logs of crash reboots (each time BusyBox prints something), the original 4:05 reboot is legit.
Code:
Feb  7 04:05:07 syslogd started: BusyBox v1.25.1
Feb  7 04:05:07 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 04:06:56 syslogd started: BusyBox v1.25.1
Feb  7 04:06:56 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 04:07:00 syslogd started: BusyBox v1.25.1
Feb  7 04:07:00 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 04:45:00 RT-AC86U-9988 Temp: 48.8 38.5 48.0 ; Mem free: 29632 KB; Swap used: 2248 KB; sda1 wrote: 52.66 MB
Feb  7 05:00:00 RT-AC86U-9988 Temp: 52.8 40.0 49.0 ; Mem free: 28084 KB; Swap used: 2704 KB; sda1 wrote: 71.17 MB
Feb  7 05:15:00 RT-AC86U-9988 Temp: 51.8 40.0 49.0 ; Mem free: 28108 KB; Swap used: 6692 KB; sda1 wrote: 108.34 MB
Feb  7 05:30:00 RT-AC86U-9988 Temp: 49.8 39.0 48.5 ; Mem free: 32552 KB; Swap used: 7936 KB; sda1 wrote: 131.66 MB
Feb  7 05:45:00 RT-AC86U-9988 Temp: 49.3 39.0 48.0 ; Mem free: 27988 KB; Swap used: 7936 KB; sda1 wrote: 146.60 MB
Feb  7 06:00:00 RT-AC86U-9988 Temp: 49.8 39.0 48.0 ; Mem free: 31888 KB; Swap used: 8964 KB; sda1 wrote: 165.92 MB
Feb  7 06:15:00 RT-AC86U-9988 Temp: 49.3 38.5 48.0 ; Mem free: 29996 KB; Swap used: 10348 KB; sda1 wrote: 188.46 MB
Feb  7 06:30:00 RT-AC86U-9988 Temp: 48.8 38.5 48.0 ; Mem free: 29176 KB; Swap used: 11596 KB; sda1 wrote: 207.98 MB
Feb  7 06:45:01 RT-AC86U-9988 Temp: 49.3 38.5 47.5 ; Mem free: 28016 KB; Swap used: 12020 KB; sda1 wrote: 228.12 MB
Feb  7 07:00:00 RT-AC86U-9988 Temp: 49.3 38.5 48.0 ; Mem free: 29644 KB; Swap used: 12564 KB; sda1 wrote: 241.40 MB
Feb  7 07:15:00 RT-AC86U-9988 Temp: 48.8 39.0 48.0 ; Mem free: 31508 KB; Swap used: 15388 KB; sda1 wrote: 276.58 MB
Feb  7 07:30:00 RT-AC86U-9988 Temp: 49.3 39.0 48.0 ; Mem free: 29368 KB; Swap used: 15192 KB; sda1 wrote: 294.45 MB
Feb  7 07:45:00 RT-AC86U-9988 Temp: 48.8 38.5 47.5 ; Mem free: 28164 KB; Swap used: 15192 KB; sda1 wrote: 308.95 MB
Feb  7 08:00:00 RT-AC86U-9988 Temp: 48.8 38.5 47.5 ; Mem free: 27252 KB; Swap used: 15628 KB; sda1 wrote: 333.14 MB
Feb  7 08:15:01 RT-AC86U-9988 Temp: 48.3 38.5 47.5 ; Mem free: 36456 KB; Swap used: 17032 KB; sda1 wrote: 356.18 MB
Feb  7 08:30:00 RT-AC86U-9988 Temp: 48.8 38.5 47.5 ; Mem free: 29576 KB; Swap used: 17448 KB; sda1 wrote: 374.15 MB
Feb  7 04:05:07 syslogd started: BusyBox v1.25.1
Feb  7 04:05:07 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 08:38:56 syslogd started: BusyBox v1.25.1
Feb  7 08:38:56 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 09:15:00 RT-AC86U-9988 Temp: 57.2 42.0 50.5 ; Mem free: 29492 KB; Swap used: 2144 KB; sda1 wrote: 58.22 MB
Feb  7 09:30:00 RT-AC86U-9988 Temp: 58.6 42.5 51.0 ; Mem free: 33224 KB; Swap used: 4436 KB; sda1 wrote: 79.27 MB
Feb  7 09:45:00 RT-AC86U-9988 Temp: 57.7 42.5 51.0 ; Mem free: 27880 KB; Swap used: 4436 KB; sda1 wrote: 101.57 MB
Feb  7 10:00:00 RT-AC86U-9988 Temp: 56.7 42.5 50.5 ; Mem free: 28728 KB; Swap used: 5260 KB; sda1 wrote: 124.29 MB
Feb  7 10:15:00 RT-AC86U-9988 Temp: 56.7 42.0 50.5 ; Mem free: 33968 KB; Swap used: 8472 KB; sda1 wrote: 154.67 MB
Feb  7 10:30:00 RT-AC86U-9988 Temp: 56.2 42.0 50.5 ; Mem free: 32772 KB; Swap used: 8808 KB; sda1 wrote: 178.65 MB
Feb  7 12:45:00 syslogd started: BusyBox v1.25.1
Feb  7 12:45:00 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 16:35:23 syslogd started: BusyBox v1.25.1
Feb  7 16:35:23 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 16:35:29 syslogd started: BusyBox v1.25.1
Feb  7 16:35:29 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 17:00:01 RT-AC86U-9988 Temp: 52.8 40.5 49.0 ; Mem free: 25984 KB; Swap used: 2312 KB; sda1 wrote: 46.28 MB
Feb  7 17:15:00 RT-AC86U-9988 Temp: 51.8 40.0 49.0 ; Mem free: 29308 KB; Swap used: 5124 KB; sda1 wrote: 70.17 MB
Feb  7 17:30:01 RT-AC86U-9988 Temp: 52.3 40.0 49.0 ; Mem free: 35296 KB; Swap used: 8064 KB; sda1 wrote: 91.64 MB
 
Weird results. After I managed to stabilize AC86u to avoid crash rebooting, with this script it did it 3 times today (!) Post one of the crashes, all cron jobs came back (27), then disappeared after another one, and got back to (22) only. The scheduled reboot in the morning at 4:05 got 20 jobs first, then in half hour it got to 22. Will probably take the script out for tomorrow's reboot, let' the router catch a breath :)

Code:
Number of Cron Jobs: [22]
2024-Feb-07, 08:37:10 AM UTC (Wed)
Number of Cron Jobs: [22]
2024-Feb-07, 08:40:36 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:42:37 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:44:38 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:46:38 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:48:39 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:50:40 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:52:41 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:54:42 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:56:43 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 08:58:44 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:00:45 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:02:46 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:04:48 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:06:49 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:08:51 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:10:52 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:12:54 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:14:55 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:16:56 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:18:58 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:20:59 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:23:00 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:25:00 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:27:01 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:29:02 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:31:03 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:33:04 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:35:05 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:37:06 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:39:06 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:41:07 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:43:08 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:45:09 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:47:10 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:49:11 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:51:13 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:53:14 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:55:16 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:57:17 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 09:59:19 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:01:20 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:03:22 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:05:23 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:07:25 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:09:26 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:11:28 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:13:29 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:15:30 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:17:32 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:19:32 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:21:33 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:23:34 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:25:35 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:27:36 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 10:29:36 AM UTC (Wed)
Number of Cron Jobs: [27]
2024-Feb-07, 04:37:05 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:39:06 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:41:08 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:43:09 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:45:11 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:47:12 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:49:14 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:51:14 PM UTC (Wed)
Number of Cron Jobs: [19]
2024-Feb-07, 04:53:15 PM UTC (Wed)
Number of Cron Jobs: [22]
2024-Feb-07, 04:55:16 PM UTC (Wed)
Number of Cron Jobs: [22]
2024-Feb-07, 04:57:17 PM UTC (Wed)
Number of Cron Jobs: [22]

Logs of crash reboots (each time BusyBox prints something), the original 4:05 reboot is legit.
Code:
Feb  7 04:05:07 syslogd started: BusyBox v1.25.1
Feb  7 04:05:07 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 04:06:56 syslogd started: BusyBox v1.25.1
Feb  7 04:06:56 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 04:07:00 syslogd started: BusyBox v1.25.1
Feb  7 04:07:00 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 04:45:00 RT-AC86U-9988 Temp: 48.8 38.5 48.0 ; Mem free: 29632 KB; Swap used: 2248 KB; sda1 wrote: 52.66 MB
Feb  7 05:00:00 RT-AC86U-9988 Temp: 52.8 40.0 49.0 ; Mem free: 28084 KB; Swap used: 2704 KB; sda1 wrote: 71.17 MB
Feb  7 05:15:00 RT-AC86U-9988 Temp: 51.8 40.0 49.0 ; Mem free: 28108 KB; Swap used: 6692 KB; sda1 wrote: 108.34 MB
Feb  7 05:30:00 RT-AC86U-9988 Temp: 49.8 39.0 48.5 ; Mem free: 32552 KB; Swap used: 7936 KB; sda1 wrote: 131.66 MB
Feb  7 05:45:00 RT-AC86U-9988 Temp: 49.3 39.0 48.0 ; Mem free: 27988 KB; Swap used: 7936 KB; sda1 wrote: 146.60 MB
Feb  7 06:00:00 RT-AC86U-9988 Temp: 49.8 39.0 48.0 ; Mem free: 31888 KB; Swap used: 8964 KB; sda1 wrote: 165.92 MB
Feb  7 06:15:00 RT-AC86U-9988 Temp: 49.3 38.5 48.0 ; Mem free: 29996 KB; Swap used: 10348 KB; sda1 wrote: 188.46 MB
Feb  7 06:30:00 RT-AC86U-9988 Temp: 48.8 38.5 48.0 ; Mem free: 29176 KB; Swap used: 11596 KB; sda1 wrote: 207.98 MB
Feb  7 06:45:01 RT-AC86U-9988 Temp: 49.3 38.5 47.5 ; Mem free: 28016 KB; Swap used: 12020 KB; sda1 wrote: 228.12 MB
Feb  7 07:00:00 RT-AC86U-9988 Temp: 49.3 38.5 48.0 ; Mem free: 29644 KB; Swap used: 12564 KB; sda1 wrote: 241.40 MB
Feb  7 07:15:00 RT-AC86U-9988 Temp: 48.8 39.0 48.0 ; Mem free: 31508 KB; Swap used: 15388 KB; sda1 wrote: 276.58 MB
Feb  7 07:30:00 RT-AC86U-9988 Temp: 49.3 39.0 48.0 ; Mem free: 29368 KB; Swap used: 15192 KB; sda1 wrote: 294.45 MB
Feb  7 07:45:00 RT-AC86U-9988 Temp: 48.8 38.5 47.5 ; Mem free: 28164 KB; Swap used: 15192 KB; sda1 wrote: 308.95 MB
Feb  7 08:00:00 RT-AC86U-9988 Temp: 48.8 38.5 47.5 ; Mem free: 27252 KB; Swap used: 15628 KB; sda1 wrote: 333.14 MB
Feb  7 08:15:01 RT-AC86U-9988 Temp: 48.3 38.5 47.5 ; Mem free: 36456 KB; Swap used: 17032 KB; sda1 wrote: 356.18 MB
Feb  7 08:30:00 RT-AC86U-9988 Temp: 48.8 38.5 47.5 ; Mem free: 29576 KB; Swap used: 17448 KB; sda1 wrote: 374.15 MB
Feb  7 04:05:07 syslogd started: BusyBox v1.25.1
Feb  7 04:05:07 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 08:38:56 syslogd started: BusyBox v1.25.1
Feb  7 08:38:56 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 09:15:00 RT-AC86U-9988 Temp: 57.2 42.0 50.5 ; Mem free: 29492 KB; Swap used: 2144 KB; sda1 wrote: 58.22 MB
Feb  7 09:30:00 RT-AC86U-9988 Temp: 58.6 42.5 51.0 ; Mem free: 33224 KB; Swap used: 4436 KB; sda1 wrote: 79.27 MB
Feb  7 09:45:00 RT-AC86U-9988 Temp: 57.7 42.5 51.0 ; Mem free: 27880 KB; Swap used: 4436 KB; sda1 wrote: 101.57 MB
Feb  7 10:00:00 RT-AC86U-9988 Temp: 56.7 42.5 50.5 ; Mem free: 28728 KB; Swap used: 5260 KB; sda1 wrote: 124.29 MB
Feb  7 10:15:00 RT-AC86U-9988 Temp: 56.7 42.0 50.5 ; Mem free: 33968 KB; Swap used: 8472 KB; sda1 wrote: 154.67 MB
Feb  7 10:30:00 RT-AC86U-9988 Temp: 56.2 42.0 50.5 ; Mem free: 32772 KB; Swap used: 8808 KB; sda1 wrote: 178.65 MB
Feb  7 12:45:00 syslogd started: BusyBox v1.25.1
Feb  7 12:45:00 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 16:35:23 syslogd started: BusyBox v1.25.1
Feb  7 16:35:23 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 16:35:29 syslogd started: BusyBox v1.25.1
Feb  7 16:35:29 kernel: klogd started: BusyBox v1.25.1 (2023-11-21 22:37:39 EST)
Feb  7 17:00:01 RT-AC86U-9988 Temp: 52.8 40.5 49.0 ; Mem free: 25984 KB; Swap used: 2312 KB; sda1 wrote: 46.28 MB
Feb  7 17:15:00 RT-AC86U-9988 Temp: 51.8 40.0 49.0 ; Mem free: 29308 KB; Swap used: 5124 KB; sda1 wrote: 70.17 MB
Feb  7 17:30:01 RT-AC86U-9988 Temp: 52.3 40.0 49.0 ; Mem free: 35296 KB; Swap used: 8064 KB; sda1 wrote: 91.64 MB
You might be a good candidate to try out @dave14305 or @SomeWhereOverTheRainBow's alternative cru command that has some built-in logging... just to see where this is all stemming from.
 
Through the script provided by dave14305, I collected 10 hours of logs. I only found that cru periodically calls the dn-vnstatgenerate script to automatically collect network traffic statistics on a regular schedule. There were no increases or decreases in the number of cru work items, and no new addition or deletion of messages for reference.

Feb 8 18:15:00 GT-AX6000-0FC8 cru[31259]: Calling PID: 31257, CMD: /bin/sh/jffs/scripts/dn-vnstatgenerate
Feb 8 18:15:00 GT-AX6000-0FC8 cru[31288]: Args: l
Feb 8 18:15:00 GT-AX6000-0FC8 cru[31288]: Calling PID: 31287, CMD: /bin/sh/jffs/scripts/dn-vnstatgenerate
Feb 8 18:15:00 GT-AX6000-0FC8 cru[31315]: Args: l
Feb 8 18:15:00 GT-AX6000-0FC8 cru[31315]: Calling PID: 31314, CMD: /bin/sh/jffs/scripts/dn-vnstatgenerate
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31585]: Args: l
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31585]: Calling PID: 31584, CMD: /bin/sh/jffs/scripts/dn-vnstatgenerate
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31599]: Args: l
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31599]: Calling PID: 31598, CMD: /bin/sh/jffs/scripts/dn-vnstatgenerate
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31613]: Args: l
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31613]: Calling PID: 31612, CMD: /bin/sh/jffs/scripts/dn-vnstatgenerate
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31627]: Args: l
Feb 8 18:15:04 GT-AX6000-0FC8 cru[31627]: Calling PID: 31626, CMD: /bin/sh/jffs/scripts/dn-vnstatgenerate

For details please refer to the cru_log.txt attachment...
 

Attachments

  • cru_log.txt
    276.2 KB · Views: 16
Through the script provided by dave14305, I collected 10 hours of logs. I only found that cru periodically calls the dn-vnstatgenerate script to automatically collect network traffic statistics on a regular schedule. There were no increases or decreases in the number of cru work items, and no new addition or deletion of messages for reference.



For details please refer to the cru_log.txt attachment...
I reverted the last change I made that logs all invocations since it can get very spammy with cru l commands. So if you want to redownload we can focus on the adds/deletes only.
 
I reverted the last change I made that logs all invocations since it can get very spammy with cru l commands. So if you want to redownload we can focus on the adds/deletes only.
I added a scribe filter to shunt cru logging out of the main log. In the folder /opt/etc/syslog-ng.d/ create a file called "cronj" or something suitable, which contains the below. Restart scribe and you should have these entries logged separately:

Code:
# move cru entries to separate file

destination d_cronj {
    file("/opt/var/log/cronj.log");
};

filter f_cronj {
    program("cru") or
    message("Args: l")
};

log {
    source(src);
    filter(f_cronj);
   destination(d_cronj);
    flags(final);
};

#eof

It's actually interesting to see how often something is being called from cron. I didn't realize that my own contribution (dn-vnstat) makes that many calls to update the stats every 5 minutes!
 
I had no idea that "/dev/null" was a person! I always thought of it as /the/ available black hole!
 
I added a scribe filter to shunt cru logging out of the main log. In the folder /opt/etc/syslog-ng.d/ create a file called "cronj" or something suitable, which contains the below. Restart scribe and you should have these entries logged separately:

Code:
# move cru entries to separate file

destination d_cronj {
    file("/opt/var/log/cronj.log");
};

filter f_cronj {
    program("cru") or
    message("Args: l")
};

log {
    source(src);
    filter(f_cronj);
   destination(d_cronj);
    flags(final);
};

#eof

It's actually interesting to see how often something is being called from cron. I didn't realize that my own contribution (dn-vnstat) makes that many calls to update the stats every 5 minutes!
Brilliant. Just what I was working on. Scribe reinstalled 🥸

I had no idea that "/dev/null" was a person! I always thought of it as /the/ available black hole!
🤣
 
I had no idea that "/dev/null" was a person! I always thought of it as /the/ available black hole!
Well, that describes my wallet after the family is done with it...
 
I added a scribefilter to shunt crulogging out of the main log.
Don't forget to add a logrotate file too. Perhaps daily and minsize 1024.
 

Similar threads

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