What's new
  • 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!

Reboot scheduler lost in cronjob after reboot.

miazza

Regular Contributor
Hi all. After having updated amtm to the latest version (might be just a cohencidence), every time that I set reboot scheduler this is written in cronjob:
Code:
The following cron jobs are active (cru l):
_____________________________________________

 .---------------- minute       (0 - 59)
 |  .------------- hour         (0 - 23)
 |  |  .---------- day of month (1 - 31)
 |  |  |  .------- month        (1 - 12) OR Jan,Feb,mar ...
 |  |  |  |  .---- day of week  (0 - 6) Sunday = 0 or 7, OR Sun,mon,Tue ...
 |  |  |  |  |
 *  *  *  *  *  command to be executed  #job_name#  ( * = every ... )

 10 7 * * Sun /bin/sh /jffs/addons/amtm/sc_update.mod -run #amtm_ScriptsUpdateNotification#
 */11 * * * * /jffs/scripts/wicens.sh cron #wicens#
 */5 * * * * /jffs/scripts/ChkWAN.sh #WAN_Check#
 */2 * * * * /etc/openvpn/server1/vpn-watchdog1.sh #CheckVPNServer1#
 00 2 * * Wed /bin/sh /opt/share/diversion/file/update-bl.div reset #Diversion_UpdateBL#
 20 5 * * * /bin/sh /opt/share/diversion/file/rotate-logs.div #Diversion_RotateLogs#
 20 17 * * * diversion count_ads count #Diversion_CountAds#
 30 1 * * Wed /bin/sh /opt/share/diversion/file/stats.div #Diversion_WeeklyStats#
 12,42 * * * * /jffs/scripts/spdmerlin generate #spdMerlin_generate#
 5 3 * * * /jffs/scripts/spdmerlin trimdb #spdMerlin_trimDB#
 10 * * * * /jffs/scripts/uiDivStats generate #uiDivStats_generate#
 1 0 * * * /jffs/scripts/uiDivStats trimdb #uiDivStats_trim#
 */2 * * * * /jffs/scripts/uiDivStats querylog #uiDivStats_querylog#
 4-59/5 * * * * /jffs/scripts/uiDivStats flushtodb #uiDivStats_flushtodb#
 0 2 * * * service reboot #amtm_RebootScheduler#

 Press Enter to return to menu

After a reboot the last row disappears.

Code:
 The following cron jobs are active (cru l):
_____________________________________________

 .---------------- minute       (0 - 59)
 |  .------------- hour         (0 - 23)
 |  |  .---------- day of month (1 - 31)
 |  |  |  .------- month        (1 - 12) OR Jan,Feb,mar ...
 |  |  |  |  .---- day of week  (0 - 6) Sunday = 0 or 7, OR Sun,mon,Tue ...
 |  |  |  |  |
 *  *  *  *  *  command to be executed  #job_name#  ( * = every ... )

 10 7 * * Sun /bin/sh /jffs/addons/amtm/sc_update.mod -run #amtm_ScriptsUpdateNo                                                                                                             tification#
 */11 * * * * /jffs/scripts/wicens.sh cron #wicens#
 */5 * * * * /jffs/scripts/ChkWAN.sh #WAN_Check#
 */2 * * * * /etc/openvpn/server1/vpn-watchdog1.sh #CheckVPNServer1#
 00 2 * * Wed /bin/sh /opt/share/diversion/file/update-bl.div reset #Diversion_U                                                                                                             pdateBL#
 20 5 * * * /bin/sh /opt/share/diversion/file/rotate-logs.div #Diversion_RotateL                                                                                                             ogs#
 20 17 * * * diversion count_ads count #Diversion_CountAds#
 30 1 * * Wed /bin/sh /opt/share/diversion/file/stats.div #Diversion_WeeklyStats                                                                                                             #
 12,42 * * * * /jffs/scripts/spdmerlin generate #spdMerlin_generate#
 5 3 * * * /jffs/scripts/spdmerlin trimdb #spdMerlin_trimDB#
 10 * * * * /jffs/scripts/uiDivStats generate #uiDivStats_generate#
 1 0 * * * /jffs/scripts/uiDivStats trimdb #uiDivStats_trim#
 */2 * * * * /jffs/scripts/uiDivStats querylog #uiDivStats_querylog#
 4-59/5 * * * * /jffs/scripts/uiDivStats flushtodb #uiDivStats_flushtodb#

How can I fix the point ?
 
You need to add the cru a command to one of the scripts executed on boot. I suggest /jffs/scripts/init-start, if it exists.
If it doesn't exist create it with the following content:
Code:
#!/bin/sh

cru a amtm_RebootScheduler "0 2 * * * service reboot"
Follow with
Code:
chmod a+rx /jffs/scripts/init-start

Why not just use the scheduler in Administration>System?
 
You need to add the cru a command to one of the scripts executed on boot. I suggest /jffs/scripts/init-start, if it exists.
If it doesn't exist create it with the following content:
Code:
#!/bin/sh

cru a amtm_RebootScheduler "0 2 * * * service reboot"

Why not use the scheduler in Administration>System?
The scheduler in the Administration is not reliable and it is a well know bug that the rooter remains stuck off and need to be unplugged from the wall in order to reset. If this happens when I am in vacation ... this is a problem.

What you described is a manual way to solve the issue but in the past this was somehow authomatically done by the amtm script dedicated to this job. Did something change ?

Init start is correctly configured:
Code:
miazza@RT-AC86U:/jffs/scripts# cat init-start
#!/bin/sh
exit 0




cru a amtm_RebootScheduler "0 2 * * * service reboot" # Added by amtm
 
Did something change ?
I don't know. It's just the way I've done things for a time now. I use init-start for things that only need executing once at every reboot.
After reading up I do exactly the same as the reboot scheduler script, just manually. But my method doesn't disappear.
 
Last edited:
init-start is well configured but the crontab does not resist a reboot:
Code:
miazza@RT-AC86U:/jffs/scripts# cat init-start
#!/bin/sh
exit 0




cru a amtm_RebootScheduler "0 2 * * * service reboot" # Added by amtm
 
After reboot the init-start is there but the crontab is not anymore containing the job:
Code:
ASUSWRT-Merlin RT-AC86U 386.14_2 Sun Nov 17 19:18:53 UTC 2024
miazza@RT-AC86U:/tmp/home/root# cd /jffs/scripts
miazza@RT-AC86U:/jffs/scripts# cat init-start
#!/bin/sh
exit 0




cru a amtm_RebootScheduler "0 2 * * * service reboot" # Added by amtm
miazza@RT-AC86U:/jffs/scripts# crontab -l
10 7 * * Sun /bin/sh /jffs/addons/amtm/sc_update.mod -run #amtm_ScriptsUpdateNot                                                                                                             ification#
*/11 * * * * /jffs/scripts/wicens.sh cron #wicens#
*/5 * * * * /jffs/scripts/ChkWAN.sh #WAN_Check#
*/2 * * * * /etc/openvpn/server1/vpn-watchdog1.sh #CheckVPNServer1#
00 2 * * Wed /bin/sh /opt/share/diversion/file/update-bl.div reset #Diversion_Up                                                                                                             dateBL#
20 5 * * * /bin/sh /opt/share/diversion/file/rotate-logs.div #Diversion_RotateLo                                                                                                             gs#
20 17 * * * diversion count_ads count #Diversion_CountAds#
30 1 * * Wed /bin/sh /opt/share/diversion/file/stats.div #Diversion_WeeklyStats#
12,42 * * * * /jffs/scripts/spdmerlin generate #spdMerlin_generate#
5 3 * * * /jffs/scripts/spdmerlin trimdb #spdMerlin_trimDB#
10 * * * * /jffs/scripts/uiDivStats generate #uiDivStats_generate#
1 0 * * * /jffs/scripts/uiDivStats trimdb #uiDivStats_trim#
*/2 * * * * /jffs/scripts/uiDivStats querylog #uiDivStats_querylog#
4-59/5 * * * * /jffs/scripts/uiDivStats flushtodb #uiDivStats_flushtodb#
miazza@RT-AC86U:/jffs/scripts#
 
mmmm, something wrong there then.
What's the contents of init-start after a reboot? What about execute permissions?
Via ssh does "/jffs/scripts/init-start" create the cronjob?
 
Last edited:
The problem is the presence of the exit 0 line in that script. Delete the init-start script and setup the scheduler again.
I do not know how the exit 0 entered in the init-start script.
I removed the file and created a new one from amtm.
After reboot the service reboot is now the first line:
Code:
ASUSWRT-Merlin RT-AC86U 386.14_2 Sun Nov 17 19:18:53 UTC 2024
miazza@RT-AC86U:/tmp/home/root# crontab -l
0 2 * * * service reboot #amtm_RebootScheduler#
10 7 * * Sun /bin/sh /jffs/addons/amtm/sc_update.mod -run #amtm_ScriptsUpdateNot                                                                                                             ification#
*/11 * * * * /jffs/scripts/wicens.sh cron #wicens#
*/5 * * * * /jffs/scripts/ChkWAN.sh #WAN_Check#
*/2 * * * * /etc/openvpn/server1/vpn-watchdog1.sh #CheckVPNServer1#
00 2 * * Wed /bin/sh /opt/share/diversion/file/update-bl.div reset #Diversion_Up                                                                                                             dateBL#
20 5 * * * /bin/sh /opt/share/diversion/file/rotate-logs.div #Diversion_RotateLo                                                                                                             gs#
20 17 * * * diversion count_ads count #Diversion_CountAds#
30 1 * * Wed /bin/sh /opt/share/diversion/file/stats.div #Diversion_WeeklyStats#
12,42 * * * * /jffs/scripts/spdmerlin generate #spdMerlin_generate#
5 3 * * * /jffs/scripts/spdmerlin trimdb #spdMerlin_trimDB#
10 * * * * /jffs/scripts/uiDivStats generate #uiDivStats_generate#
1 0 * * * /jffs/scripts/uiDivStats trimdb #uiDivStats_trim#
*/2 * * * * /jffs/scripts/uiDivStats querylog #uiDivStats_querylog#
4-59/5 * * * * /jffs/scripts/uiDivStats flushtodb #uiDivStats_flushtodb#
miazza@RT-AC86U:/tmp/home/root# cd /jffs/scripts
miazza@RT-AC86U:/jffs/scripts# cat init-start
#!/bin/sh

cru a amtm_RebootScheduler "0 2 * * * service reboot" # Added by amtm
miazza@RT-AC86U:/jffs/scripts#

Thank you
 

Latest 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!
Back
Top