SVoxel/ORBI-RBK50

crontab schedule not works

Closed this issue · 3 comments

FW: RBK50-V9.2.5.1.11SF-HW
first approach:
crontab -e and added below command
00 02 1,4,7,10,13,16,19,22,25,28 * * /sbin/reboot
crontab -l
command is there correctly.
nvram commit
reboot
crontab -l check again, GONE, nothing is there

workaround approach:
put below command in /etc/rc.local
echo "00 02 1,4,7,10,13,16,19,22,25,28 * * /sbin/reboot" >/var/spool/cron/crontabs/root && crond -c /var/spool/cron/crontabs -L /var/log/crontab.log
nvram commit
reboot

my command in rc.local is GONE.

anything that i missed or wrong?

Stock ORBI firmware uses RAM overlay partition

overlayfs:/tmp/overlay

and I did not change this, so all your changes will be lost after reboot (RAM).

Two ways to solve:

  1. Try to use "Overlay partition on USB" (see my QuickStart.txt in the zip with firmware downloaded from my site).

or

  1. Use cron from Entware. Also with a help of USB (see the same QuickStart.txt re: how to install Entware).

Voxel.

and I did not change this, so all your changes will be lost after reboot (RAM).

Therefore, there is only can do is use USB but not firmware native support?
I copied description from QuickStart.txt here. Sorry for i am not familiar this part if has stupid question.
Option A
You mean i just format a USB drive and create a /overlay and place a new /overlay/etc/rc.local would be take over firmware's rc.local? And firmware auto mount "/dev/sda1“ as "/" or something?
Here is what i trying ,please tell me whether has wrong.

  1. create a "/overlay/var/spool/cron/crontabs" folder within device "/dev/sda1"
  2. put "00 02 1,4,7,10,13,16,19,22,25,28 * * /sbin/reboot" in root crontab file.
  3. reboot
  4. Should my cron job will works and after next reboot and beyond?

2 . Overlay partition on USB.
Original stock firmware uses tmpfs overlay partition (in RAM). So all you changes in
the files/dirs are kept only until next reboot of router/satellite. If you need to keep
your changed/added files you should use external USB disk/stick formatted as
ext2/ext3/ext4 with /overlay directory on the root where you should add your new or
modified files keeping the dirtree of Orbi. For example, if you wish to use your own
/etc/dnscrypt-proxy-2.toml just place it into /overlay/etc/dnscrypt-proxy-2.toml.

Option B
I just read your README file on your "www.voxel-firmware.com". I found your below description.
Can i put "echo "00 02 1,4,7,10,13,16,19,22,25,28 * * /sbin/reboot" >/var/spool/cron/crontabs/root && crond -c /var/spool/cron/crontabs -L /var/log/crontab.log" into "autorun/scripts/post-mount.sh" as another choice besides option A? if so, what else i should setup?

  1. Changed automatic mount script: now
    a) disks with ext2/3/4 filesystems are mounted w/o “noexecute” option (i.e. you can run program/script from external drive);
    b) if partition has a label then it is mounted to /tmp/mnt/(labelname)/ directory instead of /tmp/mnt/sda1/ or /tmp/mnt/sdb1/ etc.;
    c) if external storage has the script autorun/scripts/post-mount.sh then it is executed automatically after you insert your USB stick/disk to router or after power on of your router with attached external stick/disk.

It is better IMO to modify /etc/init.d/cron i.e.

  1. copy this file from firmware to USB as /overlay/etc/init.d/cron
  2. modify this copied file adding your cronjob into /tmp/etc/crontabs just before the line

crond -c $CRONTABS -T "$($CONFIG get time_zone)"

  1. make it executable (chmod +x)

And please contact me on SNB forums in the future. Maybe in P.M. GitHub is not proper place for such support IMO.

P.S.
BTW new version 12SF-HW is released...

Voxel.