HELP WITH CRON TASK

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

jokheny
Posts: 8
Joined: Sun Aug 23, 2015 10:21 am
Location: Kenya

HELP WITH CRON TASK

Post by jokheny »

New here,
to begin with I must give a great thank you to the developers of this wonderful software.
Have been doing extensive reading on a lot of items and most have been an eye opener and worked wonders on the network. Question, I am looking for a way to use cron to change an individual entry say max speed on download class A = 2000 from 9pm to 6am then to 1000. All the documentation I have read (which were brilliant) deal with ACC, total bandwidth and qos_gargoyle reset.
Again wonderful work.

Lantis
Moderator
Posts: 7063
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: HELP WITH CRON TASK

Post by Lantis »

Here is a sample from my own QOS config.

Code: Select all

qos_gargoyle.dclass_1=download_class
qos_gargoyle.dclass_1.name=Fast
qos_gargoyle.dclass_1.percent_bandwidth=72
qos_gargoyle.dclass_2=download_class
qos_gargoyle.dclass_2.name=Slow
qos_gargoyle.dclass_2.percent_bandwidth=1
qos_gargoyle.dclass_3=download_class
qos_gargoyle.dclass_3.name=Normal
qos_gargoyle.dclass_3.percent_bandwidth=17
qos_gargoyle.dclass_4=download_class
qos_gargoyle.dclass_4.name=TS3
qos_gargoyle.dclass_4.percent_bandwidth=4
qos_gargoyle.dclass_4.min_bandwidth=600
qos_gargoyle.dclass_4.minRTT=Yes
qos_gargoyle.dclass_5=download_class
qos_gargoyle.dclass_5.name=Games
qos_gargoyle.dclass_5.percent_bandwidth=6
qos_gargoyle.dclass_5.min_bandwidth=1024
qos_gargoyle.dclass_5.minRTT=Yes
You can find this by typing
uci show qos_gargoyle

So if I wanted to change the minimum bandwidth on my gaming class from 1024 to 500 via the command line I would do:
uci set qos_gargoyle.dclass_5.min_bandwidth=500 && uci commit

Do you need further assistance to turn it into a cron job to suit your needs?
The last few posts of this thread might also be useful viewtopic.php?f=12&t=7445&p=31022#p31022
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

jokheny
Posts: 8
Joined: Sun Aug 23, 2015 10:21 am
Location: Kenya

Re: HELP WITH CRON TASK

Post by jokheny »

Thank you for the prompt reply, will try then post results.

jokheny
Posts: 8
Joined: Sun Aug 23, 2015 10:21 am
Location: Kenya

Re: HELP WITH CRON TASK

Post by jokheny »

Help with another scenario, I want to be able to enforce the changes even if there was a power loss in the period when the task was to run. If I had set it for 9pm and the router was off then when I switch it on it enforces the change since dclass at that time is value B.
Nice learning here I believe I can be a guru like some of these guys soon.

Lantis
Moderator
Posts: 7063
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: HELP WITH CRON TASK

Post by Lantis »

To do that I would look at creating a script that runs at boot and does something along the lines of:

Check time
If time X
Set the correct speed
Else if time Y
Set the correct speed
End if


You'll want to use init.d
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

jokheny
Posts: 8
Joined: Sun Aug 23, 2015 10:21 am
Location: Kenya

Re: HELP WITH CRON TASK

Post by jokheny »

Have not yet delved into the area of creating scripts. The issue of correct syntax to use, still on baby steps here and you have me trying to run. Will start reading and post what I come up with for you to counter check. Pointers to good documentation and examples will be appreciated.

Lantis
Moderator
Posts: 7063
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: HELP WITH CRON TASK

Post by Lantis »

start by learning how to browse the file structure on your router (i recommend using WinSCP).
Go to /etc/init.d/ and look at all the scripts that are in there. You should be able to find some similar syntax or structure that you are looking for.

Alternatively, any documentation on the openwrt wiki is applicable to Gargoyle.


I am happy to look over your scripts of course :)
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

jokheny
Posts: 8
Joined: Sun Aug 23, 2015 10:21 am
Location: Kenya

Re: HELP WITH CRON TASK

Post by jokheny »

Already used WinSCP for the project before so I am conversant with usage. It is 2.30pm now, will read up in the evening and come up with a working script by morning hopefully without bricking the tp link 3420 v2.

jokheny
Posts: 8
Joined: Sun Aug 23, 2015 10:21 am
Location: Kenya

Re: HELP WITH CRON TASK

Post by jokheny »

The first cron task working like a dream. All is well on that end. Still reading on enforcing the change some interesting scripts in init.d, looking for a way to implement in my scenario.

ispyisail
Moderator
Posts: 5212
Joined: Mon Apr 06, 2009 3:15 am
Location: New Zealand

Re: HELP WITH CRON TASK

Post by ispyisail »

can you post your script

Post Reply