Skip to content

Instantly share code, notes, and snippets.

@rafaelfess
Last active August 14, 2024 13:27
Show Gist options
  • Save rafaelfess/e64e73295cde1451fddf61cd98a9da4c to your computer and use it in GitHub Desktop.
Save rafaelfess/e64e73295cde1451fddf61cd98a9da4c 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