Skip to content

Instantly share code, notes, and snippets.

@tjjh89017
Forked from rafaelfess/README.md
Created August 3, 2020 10:36
Show Gist options
  • Save tjjh89017/cf4be5f3ac419f768deab1c0ad039571 to your computer and use it in GitHub Desktop.
Save tjjh89017/cf4be5f3ac419f768deab1c0ad039571 to your computer and use it in GitHub Desktop.
EdgeOS: Scheduled PPPoE reconnect configuration #EdgeRouter

EdgeOS: Scheduled PPPoE reconnect configuration

It will restart the PPPoE connection every day at 7a.m

The benefit to using the task-scheduler is that your commands get saved in config folder which ensures that they get copied over during firmware upgrades.

Creating the script file

cd /config/user-data && sudo mkdir scripts && sudo chown root scripts && cd scripts
sudo touch restart-internet.sh && sudo chown root restart-internet.sh
sudo chmod 0755 restart-internet.sh

Add the restart-internet.sh content inside the created file:

sudo vi restart-internet.sh

Commands to add it to task-scheduler

configure
set system task-scheduler task restartInternet
set system task-scheduler task restartInternet crontab-spec '58 9 * * *'
set system task-scheduler task restartInternet executable path /config/user-data/scripts/restart-internet.sh
commit
save

That's it!

Also, you can check that those commands actually created the cronjob in /etc/cron.d/vyatta-crontab.

cat /etc/cron.d/vyatta-crontab

Useful links

#!/bin/bash
run=/opt/vyatta/bin/vyatta-op-cmd-wrapper
$run disconnect interface pppoe0
sleep 3m
$run connect interface pppoe0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment