cron at specified time
cron at specified time
hi,
is there a way to run a cron job at a specified hour of the day (not at a set interval)?
tnx
is there a way to run a cron job at a specified hour of the day (not at a set interval)?
tnx
- Shotokan101
- RouterTech Team
- Posts: 4779
- Joined: Thu Jan 26, 2006 3:17 pm
- Location: Glasgow, Scotland
Re: cron at specified time
Yes - See crontab info - if it's a "runonce" type you require use the at command which is documented at the same link.cicala wrote:hi,
is there a way to run a cron job at a specified hour of the day (not at a set interval)?
tnx
EDIT: although the RT F/W only seems to have crontab available if it's to schedule a task on an RT F/W supported router.
Jim
.....I'm Sorry But I Can't Do That Dave.....
.....I'm Sorry But I Can't Do That Dave.....
tnx for the answer...
i tried and it work: I'm trying to have the wlan go down and up at scheduled times so i entered in /var/spool/cron/crontabs/root
now i would like to make the changes permanent so i tried using setenv autoexec.sh this way:
but when i type getenv i only see part of the string?? is there a limit of characters that can be typed in the envs??
also tried writing directly to /proc/sys/dev/adam2/environment but with the same resoult
any ideas?
tnx
i tried and it work: I'm trying to have the wlan go down and up at scheduled times so i entered in /var/spool/cron/crontabs/root
Code: Select all
0 8 * * * echo "begin;ap:settings/ap_enabled=1;end;begin;ap:status/cli_reboot;logic:command/save;end" | cm_cli_tty
30 23 * * * echo "begin;ap:settings/ap_enabled=0;end;begin;ap:status/cli_reboot;logic:command/save;end" | cm_cli_tty
Code: Select all
setenv autoexec.sh "echo \"0 8 \* \* \* echo \\\"begin;ap:settings/ap_enabled=1;end;begin;ap:status/cli_reboot;logic:command/save;end\\\" | cm_cli_tty\">>/var/spool/cron/crontabs/root"
also tried writing directly to /proc/sys/dev/adam2/environment but with the same resoult
any ideas?
tnx
- Shotokan101
- RouterTech Team
- Posts: 4779
- Joined: Thu Jan 26, 2006 3:17 pm
- Location: Glasgow, Scotland
Sorry I'm not sure - if it works interactively then i suspect that the problem is with you trying to write to the router's flash - the autoxexc.sh example in the F/W documentation show how to use a script hosted on n external server though which you could try in the meantime I suppose till Biro or Chief can help out.....
NOTE: delete "*" in w*get in example below - need to allow posting only on forum for security purposes.....
NOTE: delete "*" in w*get in example below - need to allow posting only on forum for security purposes.....
Code: Select all
Examples:
1. autoexec.sh
e.g.,
setenv autoexec.sh "cd /var && w*get http://fpp.com/bar.sh && chmod a+x ./bar.sh && ./bar.sh"
This will set up the router to fetch a script (bar.sh) from a website, set its executable flag, and then run it, everytime the router boots up.
Jim
.....I'm Sorry But I Can't Do That Dave.....
.....I'm Sorry But I Can't Do That Dave.....
- thechief
- RouterTech Team
- Posts: 12067
- Joined: Wed Feb 01, 2006 10:22 pm
- Location: England, the Centre of Africa
- Contact:
The adam2 environment is slightly brain dead and has a tight limit on the length of what you can store in each variable (I think the limit is 64 characters - but I may be wrong). PSPboot allows much longer values in environment variables. Your best bet is to put your command in a script, store the script on a web server, and then use autoexec.sh to download and run the script.
The Chief: 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.
No support via PM. Ask all questions on the open forum.
If the FTP server isn't avaliable, what hapens?Shotokan101 wrote:Code: Select all
Examples: 1. autoexec.sh e.g., setenv autoexec.sh "cd /var && w*get http://fpp.com/bar.sh && chmod a+x ./bar.sh && ./bar.sh" This will set up the router to fetch a script (bar.sh) from a website, set its executable flag, and then run it, everytime the router boots up.
Can you improve the script to try to download the "bar.sh" script up to the server is right and after execute it? I presume that the "autoexec.sh" script is executed before the WAN interface is up, right?
Looking to "/usr/local/bin/autoexec.sh" I suggest to change this:
To do a ping to a environment var, like AUTOEXEC_SERVER_PING, and perhaps set it as default to "google.com" like now. With this change, I can set an internal FTP server and download my startup script from it, without worrying about if it's active or not.
You agree?
Code: Select all
# make sure we have a WAN connection before starting
x=0
while [ $x -le 17 ]
do
x=`expr $x + 1`
if ping -c 1 google.com > /dev/null; then
$@
exit 0
fi
sleep 10
done
You agree?
- thechief
- RouterTech Team
- Posts: 12067
- Joined: Wed Feb 01, 2006 10:22 pm
- Location: England, the Centre of Africa
- Contact:
It may be possible - but I am not promising anything.
The Chief: 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.
No support via PM. Ask all questions on the open forum.
HELP!!!
Hi! I will schedule a job with crontab but, when I modify "/var/spool/cron/crontabs/root" adding a line such
"36 17 * * * wget -q -O /dev/null 'http://www.site.com/page.php'
and attending the time specified, nothing happens! What's wrong?
"36 17 * * * wget -q -O /dev/null 'http://www.site.com/page.php'
and attending the time specified, nothing happens! What's wrong?
- thechief
- RouterTech Team
- Posts: 12067
- Joined: Wed Feb 01, 2006 10:22 pm
- Location: England, the Centre of Africa
- Contact:
Is cron enabled? Is sntp enabled? What does "crontab -l" say?
The Chief: 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.
No support via PM. Ask all questions on the open forum.
Is cron enabled?
I don't know! How verify?
Is sntp enabled?
I don't know! (What is?) How verify?
What does "crontab -l" say?
0 */1 * * * /usr/local/bin/memopt.sh& >/dev/null 2>&1
0 */1 * * * /usr/local/bin/chksync.sh& >/dev/null 2>&1
0 */2 * * * cat /proc/avalanche/avsar_modem_stats | grep Attenuation | logger
I don't know! How verify?
Is sntp enabled?
I don't know! (What is?) How verify?
What does "crontab -l" say?
0 */1 * * * /usr/local/bin/memopt.sh& >/dev/null 2>&1
0 */1 * * * /usr/local/bin/chksync.sh& >/dev/null 2>&1
0 */2 * * * cat /proc/avalanche/avsar_modem_stats | grep Attenuation | logger
- thechief
- RouterTech Team
- Posts: 12067
- Joined: Wed Feb 01, 2006 10:22 pm
- Location: England, the Centre of Africa
- Contact:
Advanced->sntp
Tools->RT configurations
Tools->RT configurations
The Chief: 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.
No support via PM. Ask all questions on the open forum.
- thechief
- RouterTech Team
- Posts: 12067
- Joined: Wed Feb 01, 2006 10:22 pm
- Location: England, the Centre of Africa
- Contact:
Post the output of "ps aux".
The Chief: 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.
No support via PM. Ask all questions on the open forum.