bottleneck
Choose style:

Author Topic: Crontabs & WGET  (Read 6559 times)

0 Members and 1 Guest are viewing this topic.

Offline madfozi

  • Backer
  • *
  • Posts: 8
  • Thanks: 0
  • Registered : 22/08/2014
    YearsYearsYearsYearsYearsYears
Crontabs & WGET
« on: September 07, 2014, 07:50:18 am »
Hi. Did anybody successfully execute any cron jobs, especially on WGET? I did tried on both UI and SSH but seems not working.

-fauzi-
-madfozi-

Offline chevyman142000

  • Backer
  • *
  • Posts: 105
  • Thanks: 0
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #1 on: September 14, 2014, 05:52:06 pm »
No luck here..yet. Still testing and playing around. When ssh'ed into the router I tried doing a crontab -e and I get the following back: crontab: can't change directory to '/var/spool/cron/crontabs': No such file or directory

Offline fgtech

  • Backer
  • *
  • Posts: 24
  • Thanks: 1
  • Registered : 21/08/2014
    YearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #2 on: September 14, 2014, 10:21:35 pm »
I set up a few crontab entries to make a crude timer for my new GE Link LED bulb. On firmware rev. 065, here is what I did:

Login to the web UI and go to Advanced => OpenWRT.
In the OpenWRT web UI, find System => Scheduled Tasks.

You will be presented with a crontab editor. Refer to the standard crontab man page for format guidance, if needed, but it sounds as if you're familiar with crontab editing already. Make your changes and click Submit.

(If you know your way around the command line and terminal editors, you can probably also just edit /etc/crontabs/root by hand.)

Nothing will happen yet. The crond is not aware of your changes until you go to the shell (ssh, as you've done already) and run:

Code: [Select]
/etc/init.d/cron reload
My new entries still did not fire correctly at this point. It turned out the time service wasn't updating the clock on my device yet, even though the time zone was set properly. When I went into the OpenWRT UI and chose System => System and changed the time zone to something else and then back, THEN things started working properly. (N.B. after rebooting at another point I had to repeat these steps to get the time set again.)

Hope this helps!

Offline fgtech

  • Backer
  • *
  • Posts: 24
  • Thanks: 1
  • Registered : 21/08/2014
    YearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #3 on: September 19, 2014, 09:24:17 pm »
I've updated to firmware rev. 066 and the steps I described for getting cron to work are no longer valid.

Cron seems to have been disabled now, but I'm still looking into it.

Offline rpr69

  • Backer
  • *
  • Posts: 133
  • Thanks: 0
  • Registered : 08/09/2014
    YearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #4 on: September 21, 2014, 12:15:23 am »
Funny, I was just looking at setting up a cron job today and couldn't figure out how to get it working on 066. Now I know why.

LGNilsson

  • Guest
Re: Crontabs & WGET
« Reply #5 on: September 23, 2014, 11:04:40 am »
I'm pretty sure it's still working, but as we updated busybox to the latest version, it appears that you need to use sh to make cron do anything.

Offline bwainscott

  • Backer
  • *
  • Posts: 138
  • Thanks: 0
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #6 on: October 01, 2014, 01:37:33 pm »
Any status on this?  Now that I've started playing with the SDK (with some minor success), there are some things I want to run via cron, and it seems no matter what I try I get nothing.  There is no indication that crond even starts.

Offline matt

  • Backer
  • *
  • Posts: 151
  • Thanks: 1
  • Registered : 26/08/2013
    YearsYearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #7 on: October 01, 2014, 11:52:37 pm »
Edit: Apologies, I didn't notice that this was just a problem in R066... well nevermind :/ (I still haven't updated).

Any status on this?  Now that I've started playing with the SDK (with some minor success), there are some things I want to run via cron, and it seems no matter what I try I get nothing.  There is no indication that crond even starts.

I at least have crond running, but for me it does seem to work. You may want to make sure your path is set either in the crontab or at the start of your script.  I did also need to restart the cron daemon after changing the crontab (you should be able to HUP it, but I didn't really care). Here are all the little parts of my test:

Code: [Select]
root@AlmondPlus:/etc/crontabs# ps w | grep crond
 9845 root      1328 S    crond -c /etc/crontabs -l 8
root@AlmondPlus:/etc/crontabs# cat /etc/crontabs/root
*/1 * * * * /sbin/apply_pcontrol.sh
* * * * * /sbin/testcron
root@AlmondPlus:/etc/crontabs# /etc/init.d/cron restart
root@AlmondPlus:/etc/crontabs# ls -ld /sbin/testcron
-rwxr-xr-x    1 root     root            56 Oct  1 23:44 /sbin/testcron
root@AlmondPlus:/etc/crontabs# cat /sbin/testcron
#!/bin/ash
/bin/touch /tmp/asdfasdf
root@AlmondPlus:/etc/crontabs# ls -ld /tmp/asdfasdf
-rw-r--r--    1 root     root             0 Oct  1 23:48 /tmp/asdfasdf

p.s. As I was hinting, you can just add the path to your crontab, and not have to have it everywhere:

Code: [Select]
root@AlmondPlus:/etc/crontabs# cat /etc/crontabs/root
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
*/1 * * * * /sbin/apply_pcontrol.sh
* * * * * testcron
root@AlmondPlus:/etc/crontabs# cat /sbin/testcron
#!/bin/ash
touch /tmp/asdfasdf
« Last Edit: October 01, 2014, 11:57:06 pm by matt »

Offline fgtech

  • Backer
  • *
  • Posts: 24
  • Thanks: 1
  • Registered : 21/08/2014
    YearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #8 on: October 02, 2014, 12:27:25 am »
I got cron working again on R066. Here is what I found:

The status for cron in the web admin for OpenWRT (Advanced => OpenWRT => System => Startup) shows it enabled, but running a ps command from the shell clearly showed that the cron daemon was actually NOT running.

Lars is right in the sense that crond, the executable, works fine. (Starting it manually got it going.) Once I discovered that, it was pretty clear that the culprit was the startup script. When I stepped through the lines of the script (the one that tries to bring it up at boot time is at /etc/rc.d/S50cron), it eventually became clear that the script is making reference to some PROCD framework that does not exist in the rest of the current Almond+ firmware (based upon OpenWRT's old Kamikaze release, I think). The script gets as far as line 20, where the call to /sbin/validate_data silently fails because there is no such executable on the Almond+ in firmware R066.

Since OpenWRT is conveniently open, I headed over to their source repository. The startup script in the Almond+ appears to have been pulled straight from trunk: https://dev.openwrt.org/browser/trunk/package/utils/busybox/files/cron . In order to find something that would work, I looked back through the revision history to find a file that might have been more contemporary to the rest of the firmware. I stopped digging when I found this one: https://dev.openwrt.org/browser/tags/8.09_rc2/package/busybox/files/cron?rev=14166, which gets cron working again.

If you replace your /etc/rc.d/S50cron file from R066 with the OpenWRT v8.09_rc2 script above and execute the following at the command line:
Code: [Select]
/etc/rc.d/S50cron restart you should find your cron will start running again.

This is obviously not a permanent fix but I've found it a handy workaround. Hopefully it also helps the team at Securifi sort out what they need to do to make cron start properly in a future firmware release.

LGNilsson

  • Guest
Re: Crontabs & WGET
« Reply #9 on: October 02, 2014, 12:50:48 am »
Reported as a bug to the software team.

Offline fgtech

  • Backer
  • *
  • Posts: 24
  • Thanks: 1
  • Registered : 21/08/2014
    YearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #10 on: October 02, 2014, 09:25:41 am »
Thank you Lars!

Offline psifertex

  • Backer
  • *
  • Posts: 4
  • Thanks: 0
  • Registered : 17/10/2014
    YearsYearsYearsYearsYearsYears
Re: Crontabs & WGET
« Reply #11 on: October 18, 2014, 07:33:45 am »
This bug would be a good one to mention in the "known bugs" sticky note since it took me some digging to find it.  Linking to this thread from there would be really great in terms of making it easier to find.

LGNilsson

  • Guest
Re: Crontabs & WGET
« Reply #12 on: October 20, 2014, 10:29:56 pm »
This bug would be a good one to mention in the "known bugs" sticky note since it took me some digging to find it.  Linking to this thread from there would be really great in terms of making it easier to find.

Done

 

Page created in 0.045 seconds with 21 queries.