0

I'm looking for a little help. I was kinda wondering how to turn off network connection for some time period.

My question is - how to set up (for example) "Network connection is available only between 5pm and 6pm?"

Thanks

2 Answers2

0

You could use crontab to run the scripts at scheduled times. If computer is not running all the time, you may need to combine it with anacron and/or /etc/rc.local.

The commands to enable/disable network connections are:

nmcli c up id "<connection id>"
nmcli c down id "<connection id>"

You can look for connections and there ids in the /etc/NetworkManager/system-connections/.

nobody
  • 4,412
0

I think your looking for a cron job.

edit /etc/rc.local

and add the following line sudo service network-manager stop so that networking will be disabled at boot.

next you would want to add a cron job that will start networking at 5pm

crontab -e

00 17 * * 0 sudo service network-manager start

and add another job that will stop networking at 6pm

crontab -e 

00 18 * * 0 sudo service network-manager stop

How do I set up a cron job?

CronHowto wiki

Neil
  • 4,585