Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
General Discussion
»
Help to put custom jobs in CRON
« previous
next »
Print
Pages: [
1
]
Author
Topic: Help to put custom jobs in CRON (Read 1956 times)
vsta
Newbie
Posts: 2
Karma: 0
Help to put custom jobs in CRON
«
on:
January 22, 2021, 08:05:50 pm »
Hello,
I'm a brand new user here with a brand new OPNsense box running on a Lenovo ThinkCentre m92p. And so far, so good. A bit faster speed, and ability to remove quite a bit of ads.
I have a concern that needs to be addressed and hope that I can get help from here.
I have a requirement to either:
1. Scale down the internet connection speed considerably (i.e.: analog modem speed) then scale it back up to normal at certain time of day.
2. Come to worse if the above is not achievable with OPNsense then I can just bring down/up the pppoe interface again at certain time of day.
For option (1), I've created a pipe that applied to the whole network, which works beautifully, however I couldn't find a way to schedule it!
For option (2), I've tested and it works well with the command [ifconfig pppoe0 down/up], and I can manually put it to cron from the terminal, but I'd like to have that in the cron interface
I hope that you can help me to get either one of those done, I'd greatly appreciated.
Many thanks in advance
Logged
Greelan
Hero Member
Posts: 1028
Karma: 72
Help to put custom jobs in CRON
«
Reply #1 on:
January 22, 2021, 09:41:13 pm »
For (2), add a new configd action as per this:
https://docs.opnsense.org/development/backend/configd.html
If you include a description field in the action (such as description:Take PPPoE down) it will be appear in the cronjob list after running service configd restart
Use the full path for the command. If you need something more sophisticated than a single command, put a script in /usr/local/sbin and call that
Logged
mihak
Jr. Member
Posts: 70
Karma: 5
Re: Help to put custom jobs in CRON
«
Reply #2 on:
January 22, 2021, 10:30:08 pm »
Re 1:
you should look into ipfw command and use chron to call ipfw with an appropriate configuration.
The default config file for ipfw on OPNSense is:
/usr/local/etc/ipfw.rules
The config file is called as
ipfw -q /usr/local/etc/ipfw.rules
So: make a copy of ipfw.rules, change pipes as you fit, and call
ipfw -q <config>
from chron
Logged
vsta
Newbie
Posts: 2
Karma: 0
Re: Help to put custom jobs in CRON
«
Reply #3 on:
January 26, 2021, 05:09:16 pm »
Thank you @Greelan, that works very well, and which I've done. Things work perfectly.
@mihak, I guess there's no direct way to that. I'll try to implement the in-direct way from your suggestion. Will keep you posted.
Again, many thanks
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
General Discussion
»
Help to put custom jobs in CRON