create cron schedule for speedtest_cli

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
daemons
DD-WRT Novice


Joined: 15 Nov 2006
Posts: 11
Location: Hungary , Debrecen

PostPosted: Sun Feb 23, 2020 7:41    Post subject: create cron schedule for speedtest_cli Reply with quote
Hi all,

I have tried all the variations which came into my mind, without success.
Having problems with internet speed, I would like to create a log for the provider to see where is the issue.

Firmware: DD-WRT v3.0-r42460 std (02/20/20)
ASUS AC66 with AC68 firmware as addiced on wikipage.

Intension is to have a log with speeds every hour:
tried this on Administration»Management»cron - without success.
It is working good from th command shell.

Code:
0 * * * * root speedtest_cli -d 1 3 1 2 >/tmp/mnt/sda/speedtest2_`date +%Y-%m-%d_%H.%M`.txt


Any hints to solve the problem would be very welcome,at least one file per hour.


Meanwhile, I am using a similar approach on my linux, with formated output:

Quote:
Code:
LOG_PATH="/home/user/log/speedtest_$(date +%Y-%m).log"        #log per each month.
if result=$(/usr/bin/speedtest --simple); then
  parsed_result=$(printf "${result}\"" | sed ':a;N;$!ba;s/\n/" /g' | sed 's/: /="/g')
  printf "[$(date +%Y-%m-%d_%H.%M)] ${parsed_result}\n" >> "${LOG_PATH}"
else
  printf "[$(date)] error\n" >> "${LOG_PATH}"
  exit 1
fi
exit 0


Output:
[2020-02-23_08.36] Ping="17.309 ms" Download="222.99 Mbit/s" Upload="23.48 Mbit/s"

Any idea how to format the ddwrt speedtest_cli to one line output?

_________________
Linksys WRT54GL v1.1 dd-wrt v24 RC6.2 + SD Mod
Asus RT-N16 dd-wrt.v24-13972_NEWD-2_K2.6_big+ 2,5" 250Gb transmissin, no samba?
Sponsor
tcurtin
DD-WRT Novice


Joined: 12 Aug 2010
Posts: 5

PostPosted: Fri Feb 28, 2020 16:13    Post subject: Reply with quote
I'm also interested in this. Any success?
daemons
DD-WRT Novice


Joined: 15 Nov 2006
Posts: 11
Location: Hungary , Debrecen

PostPosted: Fri Feb 28, 2020 17:34    Post subject: Reply with quote
No,
however I have sold it in different way...
not a good one, but a working solution.

1. script on my system with sshpass
2. the script from my server will connect to remote and start the speedtest_cli

thats it for now,
awaiting for a good ddwrt-cron solution/hint

_________________
Linksys WRT54GL v1.1 dd-wrt v24 RC6.2 + SD Mod
Asus RT-N16 dd-wrt.v24-13972_NEWD-2_K2.6_big+ 2,5" 250Gb transmissin, no samba?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14223
Location: Texas, USA

PostPosted: Fri Feb 28, 2020 17:55    Post subject: Reply with quote
Create an executable script and call it via cron job.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
daemons
DD-WRT Novice


Joined: 15 Nov 2006
Posts: 11
Location: Hungary , Debrecen

PostPosted: Fri Feb 28, 2020 21:02    Post subject: Reply with quote
I dont really see the point of script.

The command is working by itself, should work in cron as well...but it is not !

_________________
Linksys WRT54GL v1.1 dd-wrt v24 RC6.2 + SD Mod
Asus RT-N16 dd-wrt.v24-13972_NEWD-2_K2.6_big+ 2,5" 250Gb transmissin, no samba?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14223
Location: Texas, USA

PostPosted: Fri Feb 28, 2020 21:27    Post subject: Reply with quote
Then you are not following proper formatting in the additional cron jobs config on the page OR, that is an outdated version of the cli. I don't see how it is working with those command line parameters (it won't work for me here). I do know it requires python, and your router may not have python installed...
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
daemons
DD-WRT Novice


Joined: 15 Nov 2006
Posts: 11
Location: Hungary , Debrecen

PostPosted: Fri Feb 28, 2020 21:44    Post subject: Reply with quote
I am not sure i understand the python connection here...

in the ddwrt command the following line is working properly:
speedtest_cli -d 1 3 1 2 >/tmp/mnt/sda/speedtest2_`date +%Y-%m-%d_%H.%M`.txt

hence the cron version should work also:
0 * * * * root speedtest_cli -d 1 3 1 2 >/tmp/mnt/sda/speedtest2_`date +%Y-%m-%d_%H.%M`.txt
..but it is not scheduled and does nothing, should run the command every hour.

_________________
Linksys WRT54GL v1.1 dd-wrt v24 RC6.2 + SD Mod
Asus RT-N16 dd-wrt.v24-13972_NEWD-2_K2.6_big+ 2,5" 250Gb transmissin, no samba?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14223
Location: Texas, USA

PostPosted: Fri Feb 28, 2020 22:01    Post subject: Reply with quote
speedtest-cli / speedtest_cli requires python to work or be installed, normally. The version I have is speedtest-cli from the most recent git. I don't know which version you're using. So, you may have to do some workaround or something. I don't know what will apply in this wiki: https://wiki.dd-wrt.com/wiki/index.php/CRON

How are you entering this as far as the cron job? Or rather, WHERE? This might help me help you figure this out.

mac913 wrote:
Only /tmp/cron.d/cron_jobs shows my cron jobs from the GUI. "/tmp/crontab" is an empty file.

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
daemons
DD-WRT Novice


Joined: 15 Nov 2006
Posts: 11
Location: Hungary , Debrecen

PostPosted: Fri Feb 28, 2020 22:22    Post subject: Reply with quote
enclosed

Administration> command: working

Administration> cron: nothing



ddwrt_cron.jpg
 Description:
 Filesize:  175.01 KB
 Viewed:  3284 Time(s)

ddwrt_cron.jpg



ddwrt_command.jpg
 Description:
 Filesize:  253.62 KB
 Viewed:  3284 Time(s)

ddwrt_command.jpg



_________________
Linksys WRT54GL v1.1 dd-wrt v24 RC6.2 + SD Mod
Asus RT-N16 dd-wrt.v24-13972_NEWD-2_K2.6_big+ 2,5" 250Gb transmissin, no samba?


Last edited by daemons on Sat Feb 29, 2020 6:31; edited 1 time in total
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14223
Location: Texas, USA

PostPosted: Sat Feb 29, 2020 1:30    Post subject: Reply with quote
I'm actually shocked it worked in the web command shell. But, I am wondering if that build is before certain fixes were applied. https://svn.dd-wrt.com/ticket/2621

Both pictures are the same thing. You uploaded the same picture twice. Also, did you read the wiki?

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
daemons
DD-WRT Novice


Joined: 15 Nov 2006
Posts: 11
Location: Hungary , Debrecen

PostPosted: Sat Feb 29, 2020 6:35    Post subject: Reply with quote
it seems i was already asleap yesterday...
attachments fixed.

The command part working as expected, the export created. ( shouldnt be? )

the cron part does nothing, however if i check the cron_jobs, I see the line has been added to it.

I went trough the cron wiki, but it seems without success to implement it my need.
I do not need a script as per examples, it should work as a simple line. it is just a speedtest command with a pipe for output-not a rocket science and multiple cmds.

_________________
Linksys WRT54GL v1.1 dd-wrt v24 RC6.2 + SD Mod
Asus RT-N16 dd-wrt.v24-13972_NEWD-2_K2.6_big+ 2,5" 250Gb transmissin, no samba?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14223
Location: Texas, USA

PostPosted: Sat Feb 29, 2020 14:16    Post subject: Reply with quote
Remove your # line. Then stop and restart cron via command line. That's about all I can suggest.

EDIT: Try this for your cron entry

Code:
0 * * * * root speedtest_cli -d 1 3 1 2 > /tmp/mnt/sda/speedtest2_`date +%Y-%m-%d_%H.%M`.txt


Putting the space between the > and / might fix your issue.

You may also wish to update to the latest release (42557 at the time of this post).

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
daemons
DD-WRT Novice


Joined: 15 Nov 2006
Posts: 11
Location: Hungary , Debrecen

PostPosted: Sat Feb 29, 2020 20:37    Post subject: Reply with quote
ok, I will try.
thanks for the hint.

_________________
Linksys WRT54GL v1.1 dd-wrt v24 RC6.2 + SD Mod
Asus RT-N16 dd-wrt.v24-13972_NEWD-2_K2.6_big+ 2,5" 250Gb transmissin, no samba?
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Wed Mar 11, 2020 15:22    Post subject: Reply with quote
kernel-panic69 wrote:
Remove your # line. Then stop and restart cron via command line. That's about all I can suggest.

EDIT: Try this for your cron entry

Code:
0 * * * * root speedtest_cli -d 1 3 1 2 > /tmp/mnt/sda/speedtest2_`date +%Y-%m-%d_%H.%M`.txt


Putting the space between the > and / might fix your issue.

You may also wish to update to the latest release (42557 at the time of this post).


I don't use remarks in cron jobs and I have no issues. I recall in the past that remarks in dnsmasq GUI would cause dnsmasq issues too.

I ONLY found that remarks can be added to GUI Command Startup, Shutdown, Firewall and to any custom scripts (sh files) stored on the router without any problems.

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum