Why do you need to stop Wi-Fi before reboot and start after?
This should be done automatically.
And the other commands are better to add to the /etc/rc.local
.
Probably you should clarify what exactly you want to achieve.
Start step-by-step, does this command work being run from command line?
check the logs, is there cron log? (I am not using cron in my router)
With sleep 70 && touch /etc/banner && reboot - all is ok.
-----------------------------------------------------
OpenWrt SNAPSHOT, r14267+10-18fbb9aa21
-----------------------------------------------------
root@mikrotik:~# /sbin/wifi down
'radio1' is disabled
root@mikrotik:~# uci set wireless.radio1.disabled=1
root@mikrotik:~# uci get wireless.radio1.disabled
1
root@mikrotik:~# uci set wireless.radio1.disabled=0
root@mikrotik:~# uci get wireless.radio1.disabled
root@mikrotik:~# uci set wireless.@wifi-iface[1].disabled='1'
root@mikrotik:~# wifi down radio0
root@mikrotik:~# wifi down radio1
with these commands wifi is down
# uci set wireless.@wifi-iface[0].disabled='1'; uci commit wireless; wifi
'radio1' is disabled
'radio1' is disabled
logread -> https://pastebin.com/0ZCC7Bdm
logread -e cron
is empty
dmesg -> https://pastebin.com/hPGm6wZP
I not able to run wifi via wifi up
OK, write in crontab something like: touch /etc/banner && your wifi command
, is it OK?
Sorry, you've written before, that touch /etc/banner
works. I don't understand.
Did you check the date and time stamp of the file /etc/banner
If the timestamp changes and has the correct time of when the crontab executed then crontab is working
@mbo2o's idea was practical:
Try to figure out if it is about
- crontab at all, or
- the wifi command there.
You have the crontab process running, and the file seems ok.
Is the anything in the system logs?
Just thinking along the discussion here, where the user's crontab actually contained uncommented comments...
If you have everything ok, there should be something like this in the system log for each cron action:
root@router1:~# logread | grep cron
Sun Sep 6 02:00:00 2020 cron.err crond[1698]: USER root pid 7934 cmd /etc/storeStats.sh
If there are errors, e.g. parse errors, it might be like:
Wed Aug 5 12:19:00 2020 cron.err crond[793]: user root: parse error at **This**
Wed Aug 5 12:19:00 2020 cron.err crond[793]: user root: parse error at **has**
Wed Aug 5 12:19:00 2020 cron.err crond[793]: user root: parse error at **the**
Wed Aug 5 12:19:00 2020 cron.err crond[793]: user root: parse error at **username**
Ok, will check it tomorrow. At this moment:
root@mikrotik:~# ls -l /etc/banner
-rw-r--r-- 1 root root 400 Sep 3 19:20 /etc/banner
Bingo!!! No crontab in the ps
root@mikrotik:~# ps | grep -i [c]ron
root@mikrotik:~#
# As example
root@mikrotik:~# ps | grep -i [p]rocd
1 root 1396 S /sbin/procd
root@mikrotik:~#
crontab is missing in the package database?
# ls -1
Packages*
Packages.gz*
Packages.manifest*
Packages.sig*
base-files_227-r14382+8-ad0f0df909_arm_cortex-a7_neon-vfpv4.ipk*
fstools_2020-07-11-53453438-1_arm_cortex-a7_neon-vfpv4.ipk*
fwtool_2019-11-12-8f7fe925-1_arm_cortex-a7_neon-vfpv4.ipk*
ip6tables_1.8.4-1_arm_cortex-a7_neon-vfpv4.ipk*
ipq-wifi-mikrotik_hap-ac2_1_arm_cortex-a7_neon-vfpv4.ipk*
iptables-mod-conntrack-extra_1.8.4-1_arm_cortex-a7_neon-vfpv4.ipk*
iptables-mod-ipopt_1.8.4-1_arm_cortex-a7_neon-vfpv4.ipk*
iptables_1.8.4-1_arm_cortex-a7_neon-vfpv4.ipk*
iwinfo_2020-06-03-2faa20e5-1_arm_cortex-a7_neon-vfpv4.ipk*
kernel_5.4.61-1-41e19062715338a67f255de2b91e2bd2_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ath10k-ct-smallbuffers_5.4.61+2020-06-30-edfbf916-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ath_5.4.61+5.8-1-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-cfg80211_5.4.61+5.8-1-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-gpio-button-hotplug_5.4.61-3_arm_cortex-a7_neon-vfpv4.ipk*
kmod-hwmon-core_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ifb_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ip6tables_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ipt-conntrack-extra_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ipt-conntrack_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ipt-core_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ipt-ipopt_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ipt-nat_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ipt-offload_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ipt-raw_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-leds-gpio_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ledtrig-default-on_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ledtrig-heartbeat_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ledtrig-netdev_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ledtrig-timer_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-lib-crc-ccitt_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-mac80211_5.4.61+5.8-1-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-conntrack6_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-conntrack_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-flow_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-ipt6_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-ipt_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-nat_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-reject6_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nf-reject_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-nls-base_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-ppp_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-pppoe_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-pppox_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-sched-cake_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-sched-core_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-slhc_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-usb-core_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-usb-dwc3-qcom_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-usb-dwc3_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
kmod-usb3_5.4.61-1_arm_cortex-a7_neon-vfpv4.ipk*
libc_1.1.24-2_arm_cortex-a7_neon-vfpv4.ipk*
libgcc1_8.4.0-2_arm_cortex-a7_neon-vfpv4.ipk*
libip4tc2_1.8.4-1_arm_cortex-a7_neon-vfpv4.ipk*
libip6tc2_1.8.4-1_arm_cortex-a7_neon-vfpv4.ipk*
libiwinfo-lua_2020-06-03-2faa20e5-1_arm_cortex-a7_neon-vfpv4.ipk*
libiwinfo20200105_2020-06-03-2faa20e5-1_arm_cortex-a7_neon-vfpv4.ipk*
libpthread_1.1.24-2_arm_cortex-a7_neon-vfpv4.ipk*
libxtables12_1.8.4-1_arm_cortex-a7_neon-vfpv4.ipk*
mtd_26_arm_cortex-a7_neon-vfpv4.ipk*
ubi-utils_2.1.2-1_arm_cortex-a7_neon-vfpv4.ipk*
It is part of busybox, not separate package.
- See script in
ls /etc/rc.d/*cron*
- See contents of
/etc/crontabs/
root@mikrotik:~# ls /etc/rc.d/*cron*
/etc/rc.d/S50cron
root@mikrotik:~# ls -l /usr/sbin/crond
lrwxrwxrwx 1 root root 17 Sep 3 19:20 /usr/sbin/crond -> ../../bin/busybox
root@mikrotik:~# ls -l /etc/crontabs/
-rw------- 1 root root 105 Sep 7 08:51 root
root@mikrotik:~# crontab -l
10 22 * * * sleep 70 && touch /etc/banner && reboot
15 22 * * * /sbin/wifi down
15 6 * * * /sbin/wifi up
root@mikrotik:~# ps | grep -i cron
975 root 1100 S /usr/sbin/crond -f -c /etc/crontabs -l 5
3274 root 1096 R grep -i cron
root@mikrotik:~# ls -l /etc/banner
-rw-r--r-- 1 root root 400 Sep 3 19:20 /etc/banner
root@mikrotik:~#
/etc/banner is have the same time and date (look at my previous post)
OK, delete '/etc/banner', and check again:
10 22 * * * touch /etc/banner
Does it work?
You properly had cron earlier in your screenshot's process list.
Something has changed since then ???
Have you remembered to enable the crontab service at startup?
[SLOVED]
Works like a charm , though.
0 22 * * * reboot
15 22 * * * /sbin/wifi down
15 6 * * * /sbin/wifi up
This stuck on the touch /etc/banner
I just checked myself:
10 11 * * * sleep 70 && touch /etc/banner && logger "cronjob successfully executed"
This results in the job being successfully executed:
Wed Sep 9 11:10:00 2020 cron.info crond[9142]: USER root pid 9149 cmd sleep 70 && touch /etc/banner && logger "cronjob successfully executed"
Wed Sep 9 11:11:10 2020 user.notice root: cronjob successfully executed
Have you tried restarting cron after you have edited the crontab?
No. I did not do anything.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.