cron at specified time

All about firmwares for routers. Support for RouterTech firmwares is here too.
snakessj
Novice
Novice
Posts: 28
Joined: Thu Jan 29, 2009 11:18 pm

Post by snakessj » Fri Jan 30, 2009 11:10 pm

See the attachment! This forum blocks some words inside the output :roll:
Attachments
ps aux.zip
"ps aux" output
(640 Bytes) Downloaded 299 times
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Fri Jan 30, 2009 11:26 pm

Well, both sntp and cron are operational, so you should not have a problem. It may be perhaps because of how cron works. Do all the other cron jobs work?
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
snakessj
Novice
Novice
Posts: 28
Joined: Thu Jan 29, 2009 11:18 pm

Post by snakessj » Sat Jan 31, 2009 2:10 am

Yes, I think, viewing log file:

Jan 31 01:00:01 | USER root pid 648 cmd /usr/local/bin/memopt.sh& }/dev/null 2}&1
Jan 31 01:00:01 | USER root pid 650 cmd /usr/local/bin/chksync.sh& }/dev/null 2}&1
Jan 31 02:00:01 | USER root pid 731 cmd /usr/local/bin/memopt.sh& }/dev/null 2}&1
Jan 31 02:00:02 | USER root pid 733 cmd /usr/local/bin/chksync.sh& }/dev/null 2}&1
Jan 31 02:00:02 | USER root pid 734 cmd cat /proc/avalanche/avsar_modem_stats | grep Attenuation | logger
Jan 31 02:00:02 | DS Line Attenuation: 36 DS Margin: 12
Jan 31 02:00:02 | US Line Attenuation: 20 US Margin: 12
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Sat Jan 31, 2009 10:05 am

In which case the other one will work (eventually) if you let it be.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
snakessj
Novice
Novice
Posts: 28
Joined: Thu Jan 29, 2009 11:18 pm

Post by snakessj » Sat Jan 31, 2009 11:14 am

I have a doubt, does crontab realize in real time when its list of jobs changes?
However crontab -l, after jobs file modification (adding my wget command), lists all jobs including wget...
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Sat Jan 31, 2009 4:03 pm

I think you will need to read up on the crontab manuals - particularly the busybox cron applets. But it is best to have the cron jobs in place before crond is executed (which means an "RT_init_x" or "RT_cmd_x" setting).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
snakessj
Novice
Novice
Posts: 28
Joined: Thu Jan 29, 2009 11:18 pm

Post by snakessj » Sat Jan 31, 2009 5:29 pm

Ok, tnx! :roll:
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Sat Jan 31, 2009 5:34 pm

I guess the eye-rolling means that you are unwilling to read the cron manuals for yourself, but you would prefer someone else to read them for you and tell you what is in them? If so, then you've come to the wrong place.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
snakessj
Novice
Novice
Posts: 28
Joined: Thu Jan 29, 2009 11:18 pm

Post by snakessj » Sat Jan 31, 2009 11:52 pm

Mmm, my main problem is that I am italian and I don't understand (and write) well english... :oops: however I read the manual (http://sharedhosting.net/support/crontab/man.html) and I found (I think) the problem:
Note: All crontab jobs should be submitted using crontab; you should not add jobs by just editing crontab file because cron will not be aware of changes made this way.
In reference to "-e" option! At this time I can't try because I'm not in my home, (d'oh :x) but as soon as possible I try and say you the result! :D
snakessj
Novice
Novice
Posts: 28
Joined: Thu Jan 29, 2009 11:18 pm

Post by snakessj » Tue Feb 03, 2009 1:30 pm

I finally managed to make crontab see the new job! I made it setting the editor this way as default:

Code: Select all

export VISUAL='edit'
and using CRONTAB -e command

I then, after various tries, due to the previous syntax errors, added the wget command this way:

Code: Select all

* * * * * wget -q http://www.mysite.com/script.php
The problem now is that it looks like it's being executed but it actually isn't!
Log says:

Code: Select all

Feb  2 00:49:01 | USER root pid 658 cmd wget -q http://www.mysite.com/script.php
Feb  2 00:51:01 | USER root pid 667 cmd wget -q http://www.mysite.com/script.php
Feb  2 00:52:01 | USER root pid 672 cmd wget -q http://www.mysite.com/script.php

but the script is not being executed ! If directly use "wget -q http://www.mysite.com/script.php" instead, it's perfectly performed. I've been looking everywhere in the Internet and I keep on finding always the same examples, but they won't work...where am I doing wrong? =(

PS: my girlfriend's helping me with my English, that's why my language has suddently improved XD
User avatar
Shotokan101
RouterTech Team
RouterTech Team
Posts: 4779
Joined: Thu Jan 26, 2006 3:17 pm
Location: Glasgow, Scotland

Post by Shotokan101 » Tue Feb 03, 2009 2:38 pm

Permissions on the script perhaps ?
Jim

.....I'm Sorry But I Can't Do That Dave.....
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Tue Feb 03, 2009 3:44 pm

I think there may be an issue with busybox crond and external commands. I'll investigate further over the next few days ...

Edit: investigated - no issues found - all is well.
Last edited by thechief on Tue Feb 03, 2009 11:59 pm, edited 1 time in total.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
User avatar
biro
RouterTech Team
RouterTech Team
Posts: 1274
Joined: Wed Jan 25, 2006 10:03 pm
Location: Letchworth Garden City, ENGLAND
Contact:

Post by biro » Tue Feb 03, 2009 4:51 pm

Does script.php actually get downloaded ?
Think you will need to specify the download dir

Code: Select all

wget -q -P/var/ http://www.mysite.com/script.php
even then may need to set permisssions and the execute the script.
ImageImageImage
All my posts on RouterTech.org are Copyright RouterTech.org
G'Day Laura
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Tue Feb 03, 2009 5:38 pm

biro wrote:Think you will need to specify the download dir

Code: Select all

wget -q -P/var/ http://www.mysite.com/script.php
Yes, indeed.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
snakessj
Novice
Novice
Posts: 28
Joined: Thu Jan 29, 2009 11:18 pm

Post by snakessj » Tue Feb 03, 2009 9:35 pm

I've tried and now i have this error:

Code: Select all

Feb  3 21:31:01 | failed user root parsing http://www.mysite.com/script.php
Feb  3 21:31:01 | USER root pid 476 cmd wget -q -P/var/
Feb  3 21:32:01 | USER root pid 510 cmd wget -q -P/var/
...
Post Reply